instance method around_save_collection_association

Ruby on Rails 8.1.2

Since v6.0.6 Private

Available in: v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

around_save_collection_association()

Is used as an around_save callback to check while saving a collection association whether or not the parent was a new record before saving.

Source
# File activerecord/lib/active_record/autosave_association.rb, line 402
      def around_save_collection_association
        previously_new_record_before_save = (@new_record_before_save ||= false)
        @new_record_before_save = !previously_new_record_before_save && new_record?

        yield
      ensure
        @new_record_before_save = previously_new_record_before_save
      end

Defined in activerecord/lib/active_record/autosave_association.rb line 402 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::AutosaveAssociation

Type at least 2 characters to search.

↑↓ navigate · open · esc close