1

I'm using jquery mobile in a rails 3.0 app. I am getting a routing error when attempting to delete an item from a user's list. The code and error message are as follows.

index.mobile.erb:

<% @items.each do |i| %>
   ...
   <div data-role="button">
      <%= link_to 'Delete', i, :confirm => 'Are you sure?', :method => :delete %>
   </div>
<% end %>

routes file:

resources :items, :except => [:show]

rake routes:

DELETE /items/:id(.:format)            {:action=>"destroy", :controller=>"items"}

error message:

Started GET "/items/2" for 127.0.0.1 at 2012-02-26 13:31:37 -0500
ActionController::RoutingError (No route matches "/items/2"):

What am I missing?

Thanks!

UPDATE - Firebug: @http://localhost:3000/javascripts/jquery-1.6.1.js?1310343332:641 @http://localhost:3000/javascripts/jquery.mobile-1.0.1.js?1329380575:2737 @http://localhost:3000/javascripts/jquery.mobile-1.0.1.js?1329380575:3030 @http://localhost:3000/javascripts/jquery.mobile-1.0.1.js?1329380575:3393 @http://localhost:3000/javascripts/jquery-1.6.1.js?1310343332:2926 @http://localhost:3000/javascripts/jquery-1.6.1.js?1310343332:2560 jquery...0343332 (line 641) "NetworkError: 404 Not Found - http://localhost:3000/items/2"

Jay
  • 6,206
  • 11
  • 48
  • 82

1 Answers1

1

Seems like the problem you're having is the same as mentioned @ Rails' link_to method: GETing when it should DELETE.

Can you paste rest of the request parameters (chrome developer console or firebug)? Have to see if rails is trying to do magic to accomodate the HTTP delete verb.

Community
  • 1
  • 1
Archit Baweja
  • 973
  • 7
  • 18