Tuesday, April 16, 2013

[Rails] how named routes work ?

I've been analysing a rails project where it has routes.rb like

routes.rb :

map.connect '/sessions/remote_create', :controller => '/sessions',
:action => 'remote_create'
map.resources :users, :sessions, :unfiled_documents, :appointments,
:searches, :pat_ratio
map.login '/login', :controller => '/sessions', :action => 'new'
map.logout '/logout', :controller => '/sessions', :action => 'destroy'
map.home '/', :controller => '/sessions', :action => 'index'


What I dont understand is whenever I open the app in my browser it
automatically goes to "/session/new" -- as default page

Can anybody explain how it is working ? I've heard we need to use
map.root for default page.

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate