how named routes work ?

18 views
Skip to first unread message

siva kumar

unread,
Apr 16, 2013, 3:30:35 AM4/16/13
to rubyonra...@googlegroups.com
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/.

John Ivanoff

unread,
Apr 17, 2013, 7:46:00 AM4/17/13
to rubyonra...@googlegroups.com
From the information you have provided, there may be an authentication call to see if you are legged in. In not it sends you to the login page automatically. Perhaps look in the application controller to see if there is an authentication filter.

Cheers,
John Ivanoff

Reply all
Reply to author
Forward
0 new messages