Module: Mongoid::Relations::Touchable::ClassMethods
- Defined in:
- lib/mongoid/relations/touchable.rb
Instance Method Summary collapse
-
#touchable(metadata) ⇒ Class
Add the metadata to the touchable relations if the touch option was provided.
Instance Method Details
#touchable(metadata) ⇒ Class
Add the metadata to the touchable relations if the touch option was provided.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/mongoid/relations/touchable.rb', line 53 def touchable() if .touchable? name = .name field = [:touch].is_a?(Symbol) ? [:touch] : nil method_name = define_relation_touch_method(name, field) after_save method_name after_destroy method_name after_touch method_name end self end |