delete(method = options[:dependent]) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations/has_one_association.rb, line 26
      def delete(method = options[:dependent])
        if load_target
          case method
          when :delete
            target.delete
          when :destroy
            target.destroyed_by_association = reflection
            target.destroy
            throw(:abort) unless target.destroyed?
          when :destroy_async
            primary_key_column = target.class.primary_key.to_sym
            id = target.public_send(primary_key_column)

            enqueue_destroy_association(
              owner_model_name: owner.class.to_s,
              owner_id: owner.id,
              association_class: reflection.klass.to_s,
              association_ids: [id],
              association_primary_key_column: primary_key_column,
              ensuring_owner_was_method: options.fetch(:ensuring_owner_was, nil)
            )
          when :nullify
            target.update_columns(nullified_owner_attributes) if target.persisted?
          end
        end
      end
Register or log in to add new notes.