Lille wrote: > Hi, > > In the course of integrating an authentication module (Authlogic) into > my Rails app, I've developed the following priority: > > 'If the current user makes a url request for which they are > ineligible, return the user to the page from which they made their > invalid request.' > > One way to get at this is with the following two methods in the > application_controller: > > def store_location > session[:return_to] = request.request_uri > end > > def redirect_back_or_default(default) > redirect_to(session[:return_to] || default) > session[:return_to] = nil > end > > But if I wanted to guarantee that the user was redirected back to any > action from which they made an ineligible request, I would need to > call store_location for every such controller action, which is crazy.
Not crazy at all. Just put it in a before_filter. > > Is there no inexpensive way that Rails will remember every last > request (without resort to session)? Putting it in the session is pretty inexpensive, and probably the right thing to do. > > My hope would be for something like: > > redirect_to :back > > But this is a no-go... Why? > > Lille -- Marnen Laibow-Koser http://www.marnen.org [email protected] Sent from my iPhone -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

