Revert "Merge pull request #46282 from jonathanhefner/active_model-forgetting_assignment-avoid-value_for_database"

This reverts commit 1f039d8f40, reversing
changes made to be0b5c65a1.

This revert is temporary while we debug some issues with our app. While
we're pretty sure this is caused by code in our application and a
compbination with `activerecord-typed_store`, the failure mode is easy
to miss because it doesn't raise an exception.

We will un-revert after a bit more investigation. We just want to be
confident that the other cases where this could cause issues are fixed
without being blocked from upgrading for the next month or so.
This commit is contained in:
eileencodes 2022-11-08 13:03:01 -05:00
parent 866e053732
commit dbb47d6abd
No known key found for this signature in database
GPG Key ID: 1F2A92B7CFDF7455
1 changed files with 0 additions and 13 deletions

View File

@ -175,19 +175,6 @@ module ActiveModel
type.deserialize(value)
end
def forgetting_assignment
# If this attribute was not persisted (with a `value_for_database`
# that might differ from `value_before_type_cast`) and `value` has not
# changed in place, we can simply dup this attribute to avoid
# deserialize / cast / serialize calls from computing the new
# attribute's `value_before_type_cast`.
if !defined?(@value_for_database) && !changed_in_place?
dup
else
super
end
end
private
def _original_value_for_database
value_before_type_cast