I’m just learning rails and have noticed that when I create an object that inherits from ActiveRecord::Base (i.e. from a model I migrated), the instance variables in the object do not have a @ symbol in front of them.
Is this a rails thing, or did I misunderstand something while learning ruby?
Thanks in advance for your help.
When accessing the “instance variables” of your object, you’re actually interacting with the getter/setter methods defined by rails which in turn interact with the real instance variables.
This is actually very useful as it allows you to override them when required to modify the behaviour of the variables within your classes.