Calling the controller in string


#1

Hi,
I have string or symbol that holds a controllers name (like ‘user’ or
:user). How can I call one of the class methods of this controller?
Thanks in advance


#2

On Thursday 17 November 2005 15:42, Onur T. wrote:

Hi,
I have string or symbol that holds a controllers name (like ‘user’
or :user). How can I call one of the class methods of this
controller?
Try:
str = “user” # or :user
kontroller = “#{str}_controller”.camelize.constantize
kontroller.any_method_you_want