I have a method in my ApplicationController that is part of a before_filter. How do I identify which controller is calling that method and can I pass arguments to it?
Presumably worst case, I can create a new object where I use controller names and values, then call it directly in the before_filter method with NewObject.find(:first, :conditions => ['controller_name = ?', controller_name], but that smells very bad.
So I'm open to ideas. Thanks in advance.
psuedo-short-code:
class ApplicationController < ActionController::Base
before_filter :someMethod
....
def someMethod
Do stuff
end
class SomeController < ApplicationController
# presumably the before_filter runs here
@someValueIWantToPass = some.value
...