123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::ReadonlyAttributes::ClassMethods

Relationships & Source Files
Defined in: activerecord/lib/active_record/readonly_attributes.rb

Instance Method Summary

Instance Method Details

#attr_readonly(*attributes)

::ActiveRecord::Attributes listed as readonly will be used to create a new record but update operations will ignore these fields.

[ GitHub ]

  
# File 'activerecord/lib/active_record/readonly_attributes.rb', line 13

def attr_readonly(*attributes)
  self._attr_readonly = Set.new(attributes.map { |a| a.to_s }) + (self._attr_readonly || [])
end

#readonly_attributes

Returns an array of all the attributes that have been specified as readonly.

[ GitHub ]

  
# File 'activerecord/lib/active_record/readonly_attributes.rb', line 18

def readonly_attributes
  self._attr_readonly
end