post_path has no route on Getting Started With Rails

381 views
Skip to first unread message

desbest

unread,
Oct 19, 2013, 6:48:30 PM10/19/13
to rubyonra...@googlegroups.com
I'm on Step 5.12 on the Getting Started With Rails tutorial, and I'm getting an error on http://localhost:3000/posts
 
ActionController::UrlGenerationError in Posts#index

Showing c:/mowes/www/rails_projects/blog/app/views/posts/index.html.erb where line #16 raised:

No route matches {:action=>"show", :controller=>"posts"} missing required keys: [:id]

Extracted source (around line #16):

13
14
15
16
17
18
19
          
<tr>
<td><%= post.title %></td>
<td><%= post.text %></td>
<td><%= link_to 'Show', post_path %></td>
<td><%= link_to 'Edit', edit_post_path(post) %></td>
</tr>
<% end %>
 
 
 
Is there anything that should be defined in routes.rb ?

Vipul Amler

unread,
Oct 21, 2013, 4:41:15 AM10/21/13
to rubyonra...@googlegroups.com
This seems to be fixed in the latest docs.


The highlighted line should be:

====
<td><%= link_to 'Show', post_path(post) %></td>
====

Thanks,

Vipul A.M.
+91-8149-204995


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Documentation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-do...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-docs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages