forked from manveru/ramaze
-
Notifications
You must be signed in to change notification settings - Fork 37
Knowing which controller or method triggered view layout rendering
Michel Blanc edited this page Aug 11, 2012
·
1 revision
action
contains this information. action.node
holds the Controller
class name, and action.method
the Controller's method.
However, action.method
is not available in view and layout, so if you
really need them, you'll have to save the value in your controller.
For instance :
class Controller < Ramaze::Controller
before_all do
@caller = { :controller => action.node,
:method => action.method }
end
end
Then, if your controllers inherit Controller, you'll have access to the
@caller
hash with :controller
and :method
entries in all your views and
layouts.
- Website
- Google Groups
- User Guide
- [#ramaze on the Freenode network] (http://webchat.freenode.net/?channels=ramaze)