ActiveRecord has a few different callback methods used to simplify model logic. For example after_find and before_create methods.
Consider
Nasmorn is correct.
ActiveRecord::Base placed all the column names inside @attributes instance variable (Hash) and create accessors instance methods for those column names.
For example:
card_status is a column in external_printing_cards table, it will have accessor methods with the name card_status and card_status=
Since ruby local variable definition is dynamic, the line
def after_find
....
card_status = false if self.is_used_up?
....
end
will mean we are defining and assigning to a local variable card_status rather than the instance method card_status=
The article that Peer Allan posted provides more explanation on this.
Technically you only need to use the self in front of the assignment methods. This is necessary to differentiate between a instance method with trailing = and an assignment to a local variable.