method

define_callbacks

define_callbacks(model, reflection)
public

No documentation available.

# File activerecord/lib/active_record/associations/builder/singular_association.rb, line 56
    def self.define_callbacks(model, reflection)
      super

      # If the record is saved or destroyed and `:touch` is set, the parent
      # record gets a timestamp updated. We want to know about it, because
      # deleting the association would change that side-effect and perhaps there
      # is code relying on it.
      if reflection.deprecated? && reflection.options[:touch]
        model.before_save do
          report_deprecated_association(reflection, context: ":touch has a side effect here")
        end

        model.before_destroy do
          report_deprecated_association(reflection, context: ":touch has a side effect here")
        end
      end
    end