Module: ActiveRecord::AutosaveAssociation
- Defined in:
- lib/deep_unrest.rb
Overview
monkey-patch
Instance Method Summary collapse
-
#associated_records_to_validate_or_save(association, new_record, autosave) ⇒ Object
Returns the record for an association collection that should be validated or saved.
Instance Method Details
#associated_records_to_validate_or_save(association, new_record, autosave) ⇒ Object
Returns the record for an association collection that should be validated or saved. If autosave is false only new records will be returned, unless the parent is/was a new record itself.
15 16 17 18 19 20 21 22 23 |
# File 'lib/deep_unrest.rb', line 15 def associated_records_to_validate_or_save(association, new_record, autosave) if new_record || autosave association&.target else association.target.find_all(&:new_record?) end end |