Module: Mongoid::Touchable
Defined Under Namespace
Modules: InstanceMethods
Instance Method Summary collapse
-
#define_touchable!(association) ⇒ Class
Add the association to the touchable associations if the touch option was provided.
Instance Method Details
#define_touchable!(association) ⇒ Class
Add the association to the touchable associations if the touch option was provided.
85 86 87 88 89 90 91 92 93 |
# File 'lib/mongoid/touchable.rb', line 85 def define_touchable!(association) name = association.name method_name = define_relation_touch_method(name, association) association.inverse_class.tap do |klass| klass.after_save method_name klass.after_destroy method_name klass.after_touch method_name end end |