>
> 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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to