Session reassembly?

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

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;
http://www.facebook.com/profile.php?id=blahblahblah

and you have your “user_owner” page;
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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs