Is it possible to put an if/else statemnt, and change the map.root under each condition? for ex-- if current_user map.root :controller => ''current_user'' else map.root :controller => ''home'' end cuase apparenlty that doesn''t work, so is there an alternative way? basically if the user is logged in, i dont want the homepage to be the homepage anymore, but instead the user page. NOTE:::: i can''t do a redirect_to in my home controller, because i have multiple cases (current_user, current_admin, etc) and i can''t have multiple redirects in an action. so is there a way to change the homepage according to who''s logged in? Thanks -- 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.
Hi David, Your conditional routing won''t work because routes.rb is evaluated on startup not per request. I don''t understand the rest of the question. You can''t redirect multiple times per action but you can have multiple possible redirects in an action as long as only one is executed - does that help? /Ritchie On May 2, 10:38 am, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is it possible to put an if/else statemnt, and change the map.root > under each condition? for ex-- > > if current_user > map.root :controller => ''current_user'' > > else > > map.root :controller => ''home'' > > end > > cuase apparenlty that doesn''t work, so is there an alternative way? > basically if the user is logged in, i dont want the homepage to be the > homepage anymore, but instead the user page. > > NOTE:::: i can''t do a redirect_to in my home controller, because i > have multiple cases (current_user, current_admin, etc) and i can''t > have multiple redirects in an action. > > so is there a way to change the homepage according to who''s logged in? > Thanks > > -- > 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@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, During processing of request first it executes routes. so, it''s not possible to add above type of conditional statement (authentication). For conditional routing refer - http://www.buildingwebapps.com/articles/7082-enhancing-conditional-routing-in-rails -- 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.
Ritchie, you wrote "You can''t redirect multiple times per action but you can have multiple possible redirects in an action as long as only one is executed" so how do i do that? An if/else statment doesn''t work in this case, is there another way? -- 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.
On May 5, 1:08 am, David Zhu <dzwestwindso...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ritchie, > > you wrote "You can''t redirect > multiple times per action but you can have multiple possible redirects > in an action as long as only one is executed" > > so how do i do that? An if/else statment doesn''t work in this case, is > there another way?Well in a nutshell if current_user redirect_to user_path(current_user) else redirect_to home_path end (assuming the existance of various named routes) Show us what you''ve attempted. Fred> > -- > 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@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
right, i understand..thats what i did heres my code- if current_user redirect_to current_user_path elseif current_admin redirect_to current_admin_path elseif current_secretary redirect_to current_secretary_path else @greeting = "Hello Guest" end but its saying that i have multiple rediects per action, and i do, but apparently rails thinks all of them will get executed? thats my error :-\ any suggestions? thanks -- 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.