Ruby Forum Ruby on Rails > How to activate redirection with Authorization Plugin

Posted by Mcgill Guy (Guest)
on 18.08.2008 20:34
(Received via mailing list)
I could not find any example of how to use the method :store_location
to activate the redirect feature of the authorization plugin. I am
using restful_authentication plugin and the authorization plugin . any
help will be greatly appreciated !

Guy
Posted by Ilan Berci (iberci)
on 18.08.2008 22:52
Mcgill Guy wrote:
> I could not find any example of how to use the method :store_location
> to activate the redirect feature of the authorization plugin. I am
> using restful_authentication plugin and the authorization plugin . any
> help will be greatly appreciated !
> 
> Guy

What do you want to know?  The method store_location is generated in 
lib/authenticated_system to be:

    # Store the URI of the current request in the session.
    #
    # We can return to this location by calling 
#redirect_back_or_default.
    def store_location
      session[:return_to] = request.request_uri
    end

if, you need to store an alternate url that is not located in the 
request just rewrite the method to be

    def store_location(url = request.request_uri)
      session[:return_to] = url
    end

hth

ilan
Posted by Mcgill Guy (Guest)
on 19.08.2008 15:55
(Received via mailing list)
that's true,
but the problem is that this setting is not redirecting back when
there not enough permissions, i.e only redirect to homepage gets
executed.
I would like to be able to redirect users back to the page they came
from.
any idea why this is the case?