0

Rails3 アプリケーションがあり、jquery-rails を使用しています。他のモデルのすべてのオブジェクトを削除できますが、イメージは削除できません。

クリップの問題かも?

images_controller.rb

  def destroy
    @image = Image.find(params[:id])
    @image.destroy
    flash[:notice] = "Successfully destroyed image."
    redirect_to images_url
  end 

ルート.rb

  resources :images do
    resources :comments
  end

レーキルート

                 images GET    /images(.:format)                                   {:action=>"index", :controller=>"images"}
                        POST   /images(.:format)                                   {:action=>"create", :controller=>"images"}
              new_image GET    /images/new(.:format)                               {:action=>"new", :controller=>"images"}
             edit_image GET    /images/:id/edit(.:format)                          {:action=>"edit", :controller=>"images"}
                  image GET    /images/:id(.:format)                               {:action=>"show", :controller=>"images"}
                        PUT    /images/:id(.:format)                               {:action=>"update", :controller=>"images"}
                        DELETE /images/:id(.:format)                               {:action=>"destroy", :controller=>"images"}

私のビューファイル:

 <%= link_to "Delete Image", @image, :confirm => 'Are you sure?', :method => :destroy %> 

エラー:

routing error
No route matches "/images/8"

ここでエラーがどこにあるのかわかりません。なぜ画像だけにあるのですか?

4

1 に答える 1

0

もちろん、それは :method => :delete でなければなりません。:method => :destroy ではありません。

于 2011-05-07T10:43:21.377 に答える