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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
me-n9/7VUpJCDuB+jHODAdFcQ@public.gmane.org
2013-Apr-16 10:32 UTC
Re: how named routes work ?
The route specified as: map.home ''/'', :controller => ''/sessions'', :action => ''index'' means whenever you visit "http://localhost:3000/"; it would redirect to "/sessions" controller + "/index" action On Tuesday, April 16, 2013 12:30:35 AM UTC-7, Ruby-Forum.com User wrote:> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/hg8n_z3aWmoJ. For more options, visit https://groups.google.com/groups/opt_out.
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 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/venfDlXZs6EJ. For more options, visit https://groups.google.com/groups/opt_out.