Possible Duplicate:
Ruby Assignment Syntax
I don't get the concept of an assignment method in Ruby:
def current_user=(user)
@user = user
end
If the method is declared like that, then how can you put a space before the equals sign?
def some_method(user)
self.current_user = user
end
Assignment methods are a special case of the ruby parser. There are others like [](..)
and []=(..)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With