Hello, I have a page where anyone can edit some content on it, but they must be logged in before doing so. Now, when the person clicks on my "edit" action, they are automatically redirected to the login form. Then the person logs in, but when they log in, I would like to have them redirected to the page where they wanted to edit the content on. How can I do that? Thanks, M. -- 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-/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?hl=en -~----------~----~----~----~------~----~------~--~---
Use a before_filter for the edit action? See, http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html On Jul 25, 3:34 pm, Matthew Lagace <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello, > > I have a page where anyone can edit some content on it, but they must be > logged in before doing so. Now, when the person clicks on my "edit" > action, they are automatically redirected to the login form. Then the > person logs in, but when they log in, I would like to have them > redirected to the page where they wanted to edit the content on. How can > I do that? > > Thanks, > M. > -- > Posted viahttp://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-/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?hl=en -~----------~----~----~----~------~----~------~--~---
On 7/25/07, Matthew Lagace <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hello, > > I have a page where anyone can edit some content on it, but they must be > logged in before doing so. Now, when the person clicks on my "edit" > action, they are automatically redirected to the login form. Then the > person logs in, but when they log in, I would like to have them > redirected to the page where they wanted to edit the content on. How can > I do that?The basic idea is that before you redirect to the login page, you stash away request.request_uri somewhere. (The session[] object is handy, or you can put it in a hidden field in the login form). Then, when they''ve successfully authenticated, grab the saved uri and redirect to there. (You''ll need some kind of default place to go in case they don''t come to the login page via a redirect.) I suggest you look at acts_as_authenticated (http://agilewebdevelopment.com/plugins/acts_as_authenticated). It provides this capability built in. If nothing else, you can look at his code and see how it''s done. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Great thanks alot! -- 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-/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?hl=en -~----------~----~----~----~------~----~------~--~---