lib/intercom/traits/dirty_tracking.rb in intercom-4.0.1 vs lib/intercom/traits/dirty_tracking.rb in intercom-4.1.0
- old
+ new
@@ -20,10 +20,17 @@
@changed_fields.add(field_name.to_s)
end
def field_changed?(field_name)
@changed_fields ||= Set.new
- @changed_fields.include?(field_name.to_s)
+ field = instance_variable_get("@#{field_name}")
+ if field.respond_to?(:field_changed?)
+ field.to_hash.any? do |attribute, _|
+ field.field_changed?(attribute)
+ end
+ else
+ @changed_fields.include?(field_name.to_s)
+ end
end
def instance_variables_excluding_dirty_tracking_field
instance_variables.reject{|var| var == :@changed_fields}
end