lib/mongoid/touchable.rb in mongoid-9.0.0 vs lib/mongoid/touchable.rb in mongoid-9.0.1

- old
+ new

@@ -76,11 +76,11 @@ return if touch_callbacks_suppressed? field = database_field_name(field) write_attribute(:updated_at, now) if respond_to?("updated_at=") - write_attribute(field, now) if field + write_attribute(field, now) if field.present? touches = _extract_touches_from_atomic_sets(field) || {} touches.merge!(_parent._gather_touch_updates(now) || {}) if _touchable_parent? touches end @@ -210,15 +210,9 @@ # @param [ Symbol ] name The name of the association. # @param [ Mongoid::Association::Relatable ] association The association metadata. # # @return [ Symbol ] The method name. def define_relation_touch_method(name, association) - relation_classes = if association.polymorphic? - association.send(:inverse_association_classes) - else - [ association.relation_class ] - end - method_name = "touch_#{name}_after_create_or_destroy" association.inverse_class.class_eval do define_method(method_name) do without_autobuild do if !touch_callbacks_suppressed? && relation = __send__(name)