Hi, I''m developing a site with a Login on the frontpage, so when you logged in you will see another "thing" than if you are not logged in. For Example you will see some explanations about the site if you are a visitor, but if you are logged in you will some things specific for you and i want to show that on the frontpage e.g. example.com. How can I handle that? I''m using Authlogic für Session handling and Login. My Idea is a session based Routing, but I don''t know how that can be done? greetings -- 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.
On Thu, Feb 11, 2010 at 08:23, LeonS <leonard.stellbrink-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''m developing a site with a Login on the frontpage, so when you > logged in you will see > another "thing" than if you are not logged in. > For Example you will see some explanations about the site if you are a > visitor, but if you are logged in > you will some things specific for you and i want to show that on the > frontpage e.g. example.com. > How can I handle that? I''m using Authlogic für Session handling and > Login. > My Idea is a session based Routing, but I don''t know how that can be > done? > > greetings > > -- > 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. > >As far as I know, that''s not possible. One option would be for the controller receiving that action to render entirely different templates based on whether the user is logged in: class HomeController def show if current_user render :action => ''show_logged_in'' else render :action => ''show'' end end end Note that the ''show_logged_in'' action doesn''t actually need to exist; the name of the option is a bit misleading here. Note also that the "else" statement isn''t necessary; I just included it here for clarity. Mat -- 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.
On Thu, Feb 11, 2010 at 7:23 AM, LeonS <leonard.stellbrink-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m developing a site with a Login on the frontpage, so when you > logged in you will see > another "thing" than if you are not logged in.Something like: <%= render partial => session[:user_id] ? ''logged_in'' : ''something_else'' %> -- Greg Donald destiney.com | gregdonald.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.
On Thu, Feb 11, 2010 at 11:56 AM, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Feb 11, 2010 at 7:23 AM, LeonS <leonard.stellbrink-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> I''m developing a site with a Login on the frontpage, so when you >> logged in you will see >> another "thing" than if you are not logged in. > > Something like: > > <%= render partial => session[:user_id] ? ''logged_in'' : ''something_else'' %> >The normal way to do this is to handle it at the controller level in a before filter set in the ApplicationController, used to check that the user is logged in, via the session, and/or a token, and or via basic http authentication depending on the requirements of the application, and redirects to the login url if not. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- 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.
And how does twitter is doing that? There is no Redirect to something, when i visit the Root URL As a visitor and with à Session the Main Page is my tweetlist. On 11 Feb., 19:24, Rick DeNatale <rick.denat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Feb 11, 2010 at 11:56 AM, Greg Donald <gdon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On Thu, Feb 11, 2010 at 7:23 AM, LeonS <leonard.stellbr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> I''m developing a site with a Login on the frontpage, so when you > >> logged in you will see > >> another "thing" than if you are not logged in. > > > Something like: > > > <%= render partial =>session[:user_id] ? ''logged_in'' : ''something_else'' %> > > The normal way to do this is to handle it at the controller level in a > before filter set in the ApplicationController, used to check that the > user is logged in, via thesession, and/or a token, and or via basic > http authentication depending on the requirements of the application, > and redirects to the login url if not. > > -- > Rick DeNatale > > Blog:http://talklikeaduck.denhaven2.com/ > Twitter:http://twitter.com/RickDeNatale > WWR:http://www.workingwithrails.com/person/9021-rick-denatale > LinkedIn:http://www.linkedin.com/in/rickdenatale-- 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.
On Fri, Feb 12, 2010 at 08:03, LeonS <leonard.stellbrink-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> And how does twitter is doing that? > There is no Redirect to something, when i visit the Root URL As > a visitor and with à Session the Main Page is my tweetlist. > > > > > > On 11 Feb., 19:24, Rick DeNatale <rick.denat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On Thu, Feb 11, 2010 at 11:56 AM, Greg Donald <gdon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > On Thu, Feb 11, 2010 at 7:23 AM, LeonS <leonard.stellbr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> I''m developing a site with a Login on the frontpage, so when you >> >> logged in you will see >> >> another "thing" than if you are not logged in. >> >> > Something like: >> >> > <%= render partial =>session[:user_id] ? ''logged_in'' : ''something_else'' %> >> >> The normal way to do this is to handle it at the controller level in a >> before filter set in the ApplicationController, used to check that the >> user is logged in, via thesession, and/or a token, and or via basic >> http authentication depending on the requirements of the application, >> and redirects to the login url if not. >> >> -- >> Rick DeNatale >> >> Blog:http://talklikeaduck.denhaven2.com/ >> Twitter:http://twitter.com/RickDeNatale >> WWR:http://www.workingwithrails.com/person/9021-rick-denatale >> LinkedIn:http://www.linkedin.com/in/rickdenatale > > -- > 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. > >Same action, different views. -- 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.