self.attribute calls the attribute method.
self.attribute = value calls the attribute= method with argument value .
@attribute and @attribute = value get / set the value of the @attribute instance @attribute .
So basically these are two completely different things.
However, if you call attr_accessor :attribute , it defines an attribute method to return @attribute and an attribute=(value) method to set @attribute = value . Therefore, in this case there is no difference.
sepp2k Jan 09 2018-11-11T00: 00Z
source share