I have following method in one of my module
def current_user
end
def current_user=(new_user)
end
What i wanted to know is what is the use of the method current_user=(new_user).
I also like to know following things
1. Can we declare such methods in model, controller
2. how to call such methods
3. documentation link for such things
By default all variables in ruby are private. It’s possible to access them only via methods (often named geters and setters). So
is getter and
is setter
To better understand, you can read this article:
http://zetcode.com/lang/rubytutorial/oop2/
UPD: Such methods you can use in controllers, models – in any class