Arthur Bernardes
2009-Jul-26 02:16 UTC
How knows my paths in link_to? If I do not defined.
Hello,
It´s my first post here. :)
I´l following the guide of Ruby, but I need to know how the Ruby knows
my path to other pages if I did not define anything, like this:
app/views/posts/index.html.erb:
<td><%= link_to ''Show'', post %></td>
<td><%= link_to ''Edit'', edit_post_path(post)
%></td>
Other path(home/index.html.erb):
<%= link_to "My first blog in Ruby on Rails", posts_path %>
I need help to know how Ruby knows the path of "post",
"edit_post_path(post)" and "posts_path"?
Thank you all!
ps:
The link that I´m following:
http://guides.rubyonrails.org/getting_started.html#creating-the-blog-application
--
Posted via http://www.ruby-forum.com/.
This is the convention over configuration thing. Once you define your map.resources in routes.rb, rails does the rest. documentation for public instance method resources(*entities, &block) in ActionController::Resources in lib\action_controller\resources.rb has more information
Possibly Parallel Threads
- Nil.to_sym Problem
- (Beginner) ActionController::UrlGenerationError - No route matches
- Unable to find the image path via file system using the paperclip plugin through the get method
- Unable to delete post in sample blog application
- how to use link_to with :remote=>true in rails 3.2.1