Class: Changes::CreateOrUpdate
- Inherits:
-
Object
- Object
- Changes::CreateOrUpdate
- Defined in:
- lib/dynamic_fields/changes/create_or_update.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#field_type ⇒ Object
readonly
Returns the value of attribute field_type.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, field_name, field_type, record) ⇒ CreateOrUpdate
constructor
A new instance of CreateOrUpdate.
- #save ⇒ Object
Constructor Details
#initialize(value, field_name, field_type, record) ⇒ CreateOrUpdate
Returns a new instance of CreateOrUpdate.
5 6 7 8 |
# File 'lib/dynamic_fields/changes/create_or_update.rb', line 5 def initialize(value, field_name, field_type, record) @value, @field_name, @field_type, @record = value, field_name, field_type, record @attribute = find_or_build_attribute end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
3 4 5 |
# File 'lib/dynamic_fields/changes/create_or_update.rb', line 3 def attribute @attribute end |
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
3 4 5 |
# File 'lib/dynamic_fields/changes/create_or_update.rb', line 3 def field_name @field_name end |
#field_type ⇒ Object (readonly)
Returns the value of attribute field_type.
3 4 5 |
# File 'lib/dynamic_fields/changes/create_or_update.rb', line 3 def field_type @field_type end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
3 4 5 |
# File 'lib/dynamic_fields/changes/create_or_update.rb', line 3 def record @record end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/dynamic_fields/changes/create_or_update.rb', line 3 def value @value end |
Instance Method Details
#save ⇒ Object
10 11 12 13 |
# File 'lib/dynamic_fields/changes/create_or_update.rb', line 10 def save attribute.value = value record.public_send("#{field_name}_attribute=", attribute) end |