Closed syphax-bouazzouni closed 5 months ago
This PR adds the possibility to add an onUpdate callback to a model attribute
For example
attribute :name, enforce: [:string, :existence] attribute :first_name, onUpdate: :update_name attribute :last_name, onUpdate: :update_name def update_name(inst, attr) self.name = self.first_name + self.last_name end
Will ensure that each time we update firt_name or last_name we call the method update_name and make that name will always be firt_name + last_name
update_name
add onUpdate callback tests
implement enforce_callback to run an attribute callback
move the attribute default callback to the save method
implement onUpdate DSL in the resource settings
call the attributes onUpdate callback in the save method
replaced by https://github.com/ncbo/goo/pull/151
Requirement
This PR adds the possibility to add an onUpdate callback to a model attribute
For example
Will ensure that each time we update firt_name or last_name we call the method
update_name
and make that name will always be firt_name + last_nameChanges
add onUpdate callback tests
implement enforce_callback to run an attribute callback
move the attribute default callback to the save method
implement onUpdate DSL in the resource settings
call the attributes onUpdate callback in the save method