Method: Model#assign_attribute
- Defined in:
- lib/volt/models/model.rb
#assign_attribute(method_name, *args, &block) ⇒ Object
Do the assignment to a model and trigger a changed event
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/volt/models/model.rb', line 100 def assign_attribute(method_name, *args, &block) # Free any cached value free(method_name) self. # Assign, without the = attribute_name = method_name[0..-2].to_sym value = args[0] attributes[attribute_name] = wrap_value(value, [attribute_name]) @deps.changed!(attribute_name) # Let the persistor know something changed @persistor.changed(attribute_name) if @persistor end |