# Session reassembly?

**URL:** <https://www.ruby-forum.com/t/session-reassembly/137165>\
**Category:** Rails\
**Created:** [May 9, 2008, 4:36pm UTC](https://www.ruby-forum.com/t/session-reassembly/137165 "2008-05-09T16:36:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas\_Happe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f4b2a3/32.png) [@Andreas\_Happe](https://www.ruby-forum.com/u/Andreas_Happe)\
**Post date:** [May 9, 2008, 4:36pm UTC](https://www.ruby-forum.com/t/session-reassembly/137165/1 "2008-05-09T16:36:53Z")

</div>

Hi,  
I want to redistribute incoming requests to different controllers,  
e.g. depending upon the request’s user id a request should be  
dispatched to user\_owner\_controller or user\_other\_controller.

So far I’ve just extended RouteSet to ask the controller which in turn  
should return the ‘real’ controller that should be executed:

ActionController::Routing::RouteSet.class\_eval do  
alias\_method :recognize\_orig, :recognize

```
def recognize(request)
  controller = recognize_orig(request)
  if defined? controller.acl then
    controller.acl
  else
    controller
  end
end

```

end

I’ve got the following problem: in the controller’s acl method neither  
session nor param is populated. Is there any way to create those  
hashes?

Or: is there a better way to accomplish the needed behaviour?

cheers,  
Andreas Happe

---

<div class="post-metadata">

**Author:** ![Andreas\_Happe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f4b2a3/32.png) [@Andreas\_Happe](https://www.ruby-forum.com/u/Andreas_Happe)\
**Post date:** [May 11, 2008, 2:51am UTC](https://www.ruby-forum.com/t/session-reassembly/137165/2 "2008-05-11T02:51:52Z")

</div>

Andreas Happe wrote:

> Hi,  
> I want to redistribute incoming requests to different controllers,  
> e.g. depending upon the request’s user id a request should be  
> dispatched to user\_owner\_controller or user\_other\_controller.

I don’t really understand the reason you want to work like that.  
If the function of the two controllers are different,  
then it seems fair enough to have two different paths.

I don’t know the context of your site,  
but if you think of facebook,

you have you “user\_other” page;  
[Redirecting...](http://www.facebook.com/profile.php?id=blahblahblah)

and you have your “user\_owner” page;  
[Facebook](http://www.facebook.com/editprofile.php)

two ways of looking at the same profile,  
but approaching it in two different ways,  
has two different urls.

Else, just redirect the “user\_owner” to a different controller,  
if they’re the owner,  
they’re probably happy to move to a “/owner” url temporarily,  
and you can make sure all the urls they could click on would go here  
directly.
