I''m having a problem getting the logout to work correct. The sessions controller is how one logs in and out: Here is the destroy action: def destroy self.current_user.forget_me if logged_in? cookies.delete :auth_token reset_session flash[:notice] = "You have been logged out." redirect_to(''index/welcome'') end Just to preface, on my home page if user is logged in it displays the user name. The cookies and sessions are working correctly. However I''ve tried to get the logouts 2 ways: One is by creating a link_to ''sessions/destroy'' This seems to do nothing , but return an error: Unknown action No action responded to show The other way is that I just link to sessions which gives me an nil.login error for this view: <%= current_user.login %> <%= current_user.created_at.strftime("%m/%d/%Y") %> I''d expect it being REST , that I need the link to show something like /destroy;6 Any ideas would be appreciated. Stuart -- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/23/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I''m having a problem getting the logout to work correct. > > The sessions controller is how one logs in and out: > Here is the destroy action: > > def destroy > self.current_user.forget_me if logged_in? > cookies.delete :auth_token > reset_session > flash[:notice] = "You have been logged out." > redirect_to(''index/welcome'') > end > > Just to preface, on my home page if user is logged in it displays the > user name. The cookies and sessions are working correctly. However > I''ve tried to get the logouts 2 ways: > One is by creating a link_to ''sessions/destroy'' This seems to do > nothing , but return an error: > Unknown action > No action responded to show > > The other way is that I just link to sessions which gives me an > nil.login error for this view: > <%= current_user.login %> > <%= current_user.created_at.strftime("%m/%d/%Y") %> > > I''d expect it being REST , that I need the link to show something like > /destroy;6 > > Any ideas would be appreciated. > StuartHi Stuart, I''m exploring this plugin, and rest myself at the moment. I''ve just played with the routes on this one to see if it works. The following works if map.resources :sessions, :users is defined <%= link_to "Logout", session_url, :method => :delete %> I was concerned initially that I would need to identify the session that it will destroy. Then I realised there is no model for the session to identify with an id. Instead the sessions controller is just an interface to the session itself. In the destroy method, all actions taken are in relation to the current session only so nothing is actually being affected in the db. A link to session_url with the method :delete causes the routes to map this to the destroy method. This is seriously taking some getting used to for me. Cheers Daniel --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Stoyan Zhekov
2006-Sep-23 15:17 UTC
Re: Anyone using Restful_Authentication or could tell me ?
Take a look on http://restolog.googlecode.com/svn/trunk/ - i''m using restful auth --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Dark Ambient
2006-Sep-23 17:10 UTC
Re: Anyone using Restful_Authentication or could tell me ?
On 9/23/06, Stoyan Zhekov <stoyan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Take a look on http://restolog.googlecode.com/svn/trunk/ - i''m using > restful auth >I see rest_auth as one of the plugins, is there added documentation in there from you ? Stuart --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Dark Ambient
2006-Sep-23 17:18 UTC
Re: Anyone using Restful_Authentication or could tell me ?
On 9/23/06, Daniel N <has.sox-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m exploring this plugin, and rest myself at the moment. I''ve just played > with the routes on this one to see if it works. > > The following works if > map.resources :sessions, :users > is defined > > <%= link_to "Logout", session_url, :method => :delete %> > > I was concerned initially that I would need to identify the session that it > will destroy. Then I realised there is no model for the session to identify > with an id. > > Instead the sessions controller is just an interface to the session itself. > In the destroy method, all actions taken are in relation to the current > session only so nothing is actually being affected in the db. > > A link to session_url with the method :delete causes the routes to map this > to the destroy method. > > This is seriously taking some getting used to for me. > > Cheers > DanielThanks for the information Daniel. Running the link removes the token and session. However I''m getting this error Routing Error no route found to match "/welcome" with {:method=>:get} So the routes are set up correctly as you stated above and have been. However my main page is is the index / welcome (action) And in the destroy method I configured the blank redirect_to redirect_to(''index/welcome'') So I think it was just set to default, perhaps I should have left it at that ? Gonna try it. Stuart --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Dark Ambient
2006-Sep-23 17:19 UTC
Re: Anyone using Restful_Authentication or could tell me ?
On 9/23/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9/23/06, Daniel N <has.sox-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m exploring this plugin, and rest myself at the moment. I''ve just played > > with the routes on this one to see if it works. > > > > The following works if > > map.resources :sessions, :users > > is defined > > > > <%= link_to "Logout", session_url, :method => :delete %> > > > > I was concerned initially that I would need to identify the session that it > > will destroy. Then I realised there is no model for the session to identify > > with an id. > > > > Instead the sessions controller is just an interface to the session itself. > > In the destroy method, all actions taken are in relation to the current > > session only so nothing is actually being affected in the db. > > > > A link to session_url with the method :delete causes the routes to map this > > to the destroy method. > > > > This is seriously taking some getting used to for me. > > > > Cheers > > Daniel > > Thanks for the information Daniel. Running the link removes the token > and session. However I''m getting this error > Routing Error > no route found to match "/welcome" with {:method=>:get} > > So the routes are set up correctly as you stated above and have been. > However my main page is is the index / welcome (action) > And in the destroy method I configured the blank redirect_to > redirect_to(''index/welcome'') > > So I think it was just set to default, perhaps I should have left it > at that ? Gonna try it. > > Stuart >And yes it works now. Who am I to go changing code :). Thanks for the help. Stuart --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---