I have a rails3 application and I am using jquery-rails.. I can delete all the objects of my other models, but not my images.
Maybe an paperclip problem?
images_controller.rb
def destroy
@image = Image.find(params[:id])
@image.destroy
flash[:notice] = "Successfully destroyed image."
redirect_to images_url
end
routes.rb
resources :images do
resources :comments
end
rake routes
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"}
my view file:
<%= link_to "Delete Image", @image, :confirm => 'Are you sure?', :method => :destroy %>
the error:
routing error
No route matches "/images/8"
I don't get where is the error here, and why it is only with the images?
It has of course to be :method => :delete, not :method => :destroy