src code

instance method ActiveRecord.Model#set

ActiveRecord.Model#set(key,value[,suppress_notifications = false]) → null

Sets a given key on the object. You must use this method to set a property, properties assigned directly (instance.key_name = value) will not persist to the database and may cause errors.