diff --git a/lib/active_interaction/extras/model_fields.rb b/lib/active_interaction/extras/model_fields.rb index cc7438b..1948b7f 100644 --- a/lib/active_interaction/extras/model_fields.rb +++ b/lib/active_interaction/extras/model_fields.rb @@ -81,14 +81,18 @@ def given_model_fields(model_name) # the one on the model def any_changed?(*fields) fields.any? do |field| - if inputs.given?(field) - model_field = self.class.model_field_cache_inverse[field] - - if model_field - send(model_field).send(field) != send(field) - else + model_field = self.class.model_field_cache_inverse[field] + if model_field + model = send(model_field) + if model.new_record? true + elsif inputs.given?(field) + model.send(field) != send(field) + else + false end + else + inputs.given?(field) end end end