- # This is obviously one of your helper files
- YourApp.helpers do
- # see lib/current_controller_and_action.rb for more on why this works
- # (and also why this is kind of a kludge)
- def current_controller_and_action
- @current_controller_and_action ||= begin
- act, clr = @_template.to_s.sub(%r!^/!, "").split("/").reverse
- clr ||= "app"
- [clr, act]
- def current_controller; current_controller_and_action; end
- def current_action; current_controller_and_action; end
a guest Mar 31st, 2012 9 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data