Module: ActiveRecord::ReadonlyAttributes::ClassMethods
- Defined in:
- lib/active_record/readonly_attributes.rb
Instance Method Summary collapse
-
#attr_readonly(*attributes) ⇒ Object
Attributes listed as readonly will be used to create a new record but update operations will ignore these fields.
-
#readonly_attributes ⇒ Object
Returns an array of all the attributes that have been specified as readonly.
Instance Method Details
#attr_readonly(*attributes) ⇒ Object
Attributes listed as readonly will be used to create a new record but update operations will ignore these fields.
14 15 16 |
# File 'lib/active_record/readonly_attributes.rb', line 14 def attr_readonly(*attributes) self._attr_readonly = Set.new(attributes.map { |a| a.to_s }) + (self._attr_readonly || []) end |
#readonly_attributes ⇒ Object
Returns an array of all the attributes that have been specified as readonly.
19 20 21 |
# File 'lib/active_record/readonly_attributes.rb', line 19 def readonly_attributes self._attr_readonly end |