Class: ActiveRecord::Associations::Builder::SingularAssociation
- Inherits:
-
Association
- Object
- Association
- ActiveRecord::Associations::Builder::SingularAssociation
- Defined in:
- activerecord/lib/active_record/associations/builder/singular_association.rb
Overview
:nodoc:
Constant Summary
Constants inherited from Association
Class Method Summary collapse
Methods inherited from Association
Class Method Details
.define_callbacks(model, reflection) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# 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.[: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 |