>
> My issue is how to detect if the controller/action requires a login?
>

I think you're going to have a fair bit of monkeying around to do.

A hint in the right direction is you can do this:

controller = "#{options[:controller]}_controller".camelize.constantize
controller.filter_chain.map(&:method)

There's probably a better way of doing step 1, in case you have namespaced
controllers or something, but still.

Once you have the filter methods (from step 2) you can iterate over them and
see if your login_required filter is present.  You may have to do some more
monkeying in the options in each of the objects returned by filter_chain to
check for :only and :except options and handle those.

If you are linking to a URL rather than a :controller/:action pair you may
want to use something like this in step 1:

controller_name =
ActionController::Routing::Routes.recognize_path(path)[:controller]

Anyway, it's going to be quite deep/tricky, but that may give you a nudge in
the right direction.  Post back if you need more help.

Cheers,


Andy

-- 
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.

Reply via email to