One class instance throw all controller
- by Falcon
Hello
i i have different class and controller.
and i need that one instance of model will be available in controller/
now i'm doing something like this:
def method1
inst = @MyClass.new(params)
inst.action
....
def method2
inst = @MyClass.new(params)
inst.action
....
but i want something like this
def method1
@inst.action
....
def method2
@inst.action
or self.inst i't doesn't matter
how i can do it?
def self.inst
MyClass.new(params)
end
doesn't work...