Module: ActiveFields::ValueConcern
- Extended by:
- ActiveSupport::Concern
- Included in:
- Value
- Defined in:
- app/models/concerns/active_fields/value_concern.rb
Overview
Model mix-in with a base logic for the active fields value model
Instance Attribute Summary collapse
-
#temp_value ⇒ Object
readonly
Returns the value of attribute temp_value.
Instance Method Summary collapse
Instance Attribute Details
#temp_value ⇒ Object (readonly)
Returns the value of attribute temp_value.
26 27 28 |
# File 'app/models/concerns/active_fields/value_concern.rb', line 26 def temp_value @temp_value end |
Instance Method Details
#value ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/models/concerns/active_fields/value_concern.rb', line 37 def value return unless active_field assign_value_from_temp if temp_value active_field.value_caster.deserialize(["const"]) end |
#value=(v) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'app/models/concerns/active_fields/value_concern.rb', line 28 def value=(v) if active_field clear_temp_value ["const"] = active_field.value_caster.serialize(v) else assign_temp_value(v) end end |