In the Rails guides: http://guides.rubyonrails.org/getting_started.html It mentions that we have the following in the "routes.rb" file: map.connect '':controller/:action/:id'' map.connect '':controller/:action/:id.:format'' Now, in completing the tutorial, we will add the following to "routes.rb": map.root :controller => "home" In the first two statements we have :controller, and in the last statement, we have a :controller pointing to a value. How does Rails determine that the first two statements point to a :controller other than the last statement? And, in the last statement, what are we exactly saying? Thanks. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
For, map.root :controller => "home", I noticed that .root is a method that tells Rails that this route is applied to requests made for the root of the site. http://guides.rubyonrails.org/routing.html -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> > It mentions that we have the following in the "routes.rb" file: > > map.connect '':controller/:action/:id'' > map.connect '':controller/:action/:id.:format'' > > Now, in completing the tutorial, we will add the following to > "routes.rb": > > map.root :controller => "home" > > In the first two statements we have :controller, and in the last > statement, we have a :controller pointing to a value. > > How does Rails determine that the first two statements point to a > :controller other than the last statement? >Because it''s mapping a URL pattern to a controller and action. For example, it means that: http://www.example.com/users Will go to the UsersController''s index action (because index is the default action) with no id (as nil is the default for a missing parameter at the end). http://www.example.com/users/show/1 Will map to the show actions of UsersController passing in a params[:id] of 1. And, in the last statement, what are we exactly saying?>That the / (http://www.example.com/) should go to the HomeController class''s index action (as index is the default as above). Cheers, Andy -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Andy. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.