What is the difference between self.name and @name in case of a model class?
if I set @name = “ankur” inside a before_create filter then this does not work but self.name = “ankur” works.
What is the difference between self.name and @name in case of a model class?
if I set @name = “ankur” inside a before_create filter then this does not work but self.name = “ankur” works.
self.name
is a method call whereas @name =
is an instance variable assignment. I prefer to use the setters wherever possibe.
Oh. Thanks
And then there’s CoffeeScript, which is just different enough to trip you up when you have to context switch from Ruby…