views:

14

answers:

1

I'm just trying to get the link to point to "user/1/post/1". I've tried using the link_to with and without the :method key and got the same results.

ActionController::RoutingError in Posts#index

Showing /home/test/rails_apps/test_app/app/views/posts/index.html.erb where line #22 raised:

No route matches {:action=>"destroy", :controller=>"posts", :user_id=>#<Post id: 1, content: "wtf", user_id: 1, created_at: "2010-10-27 20:46:46", updated_at: "2010-10-27 20:46:46">}

Extracted source (around line #22):

22:     <td><%= link_to 'Show', user_post_path(p), :method => :get %></td>
+1  A: 

Be careful with the ":method" argument. It specifies an HTTP method, not the action.

TreyE
Ok. I changed it to :get from :show and it's still looking for the destroy route.
chsonnu
I'd expect it to still be a problem, I just wanted to make sure that that was one issue that *wasn't* causing it. I also upvoted because I don't completely understand why this is happening either.
TreyE