3 ms·
Do people really use implicit selfs in ruby? Note that @foo is not an implicit self.
by masklinn 10y ago
Do people really use implicit selfs in ruby? Note that @foo is not an implicit self.
- pmontra 10y agoself.attribute = attribute in an ActiveRecord class when the left side is a field of a table and the right side is a variable. A different name for the variable fixes it without using self.
- masklinn 10y ago> self.attribute = attribute in an ActiveRecord class when the left side is a field of a table and the right side is a variable That seems to be an example of not using an implicit self. > A different name for the variable fixes it There's nothing to fix, it works just fine.
- matthewmacleod 10y agoLiterally all the time. In fact, our coding style demands that we avoid using instance variables in preference of adding `attr_accessor` to explicitly encourage the use of implicit self.
- keymone 10y agoevery time you call a method without explicit receiver you're using implicit self