Module: CoreExtensions::HerSaveOnlyChangedAttrs
- Defined in:
- lib/vindi/core_extensions/her_save_only_changed_attrs.rb
Overview
WARNING: monkey patch (github.com/remi/her/blob/master/lib/her/model/relation.rb#L34)
Instance Method Summary collapse
-
#save ⇒ Object
Validate record before save and after the request put the errors in the right places.
Instance Method Details
#save ⇒ Object
Validate record before save and after the request put the errors in the right places.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vindi/core_extensions/her_save_only_changed_attrs.rb', line 30 def save if new? super else save_current_changes end response_errors.any? && errors.clear && response_errors.each do |re| errors.add re[:attribute], re[:type], message: re[:message] end return false if errors.any? self end |