# How to activate redirection with Authorization Plugin

**URL:** <https://www.ruby-forum.com/t/how-to-activate-redirection-with-authorization-plugin/146183>\
**Category:** Rails\
**Created:** [August 18, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/how-to-activate-redirection-with-authorization-plugin/146183 "2008-08-18T20:34:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mcgill\_Guy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/13edae/32.png) [@Mcgill\_Guy](https://www.ruby-forum.com/u/Mcgill_Guy)\
**Post date:** [August 18, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/how-to-activate-redirection-with-authorization-plugin/146183/1 "2008-08-18T20:34:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mcgill\_Guy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/13edae/32.png) [@Mcgill\_Guy](https://www.ruby-forum.com/u/Mcgill_Guy)\
**Post date:** [August 18, 2008, 10:52pm UTC](https://www.ruby-forum.com/t/how-to-activate-redirection-with-authorization-plugin/146183/2 "2008-08-18T22:52:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mcgill\_Guy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/13edae/32.png) [@Mcgill\_Guy](https://www.ruby-forum.com/u/Mcgill_Guy)\
**Post date:** [August 19, 2008, 3:55pm UTC](https://www.ruby-forum.com/t/how-to-activate-redirection-with-authorization-plugin/146183/3 "2008-08-19T15:55:46Z")

</div>

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?
