Hi there!
How to set a local variable from a name inside a controller method?
In other words an equivalent to:
@my_object = MyObject.find(params[:id])
when I have only
name = "my_object"
How to set it as an local variable (with @ thingy)
??? = Object.const_get(name.classify).find(params[:id])
is there some kind of a method for the controller, something which
looks similar to this:
set_local_object name,
Object.const_get(name.classify).find(params[:id])
^^^^^^^^^^^^^^^^
?
Thanks,
Mirek Rusin