src code

instance method ActiveRecord.Model#toSerializableObject

ActiveRecord.Model#toSerializableObject([transform_callback]) → Object

toJSON will call this instead of toObject() to get the data they will serialize. By default this calls toObject(), but you can override this method to easily create custom JSON output. - transform_callback (Function): Will recieve and should reutrn a hash of attributes.