diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-06-06 19:20:13 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-06-06 19:29:39 +0900 |
commit | 702b1768c425e7187ef4c62beb1ed12ed7774d83 (patch) | |
tree | 3f9c7e9f3fd4215c5202fc34909256139e98ce44 /activerecord/lib | |
parent | d0d3e964920602aa710507f6717010d852e37c86 (diff) | |
download | rails-702b1768c425e7187ef4c62beb1ed12ed7774d83.tar.gz rails-702b1768c425e7187ef4c62beb1ed12ed7774d83.tar.bz2 rails-702b1768c425e7187ef4c62beb1ed12ed7774d83.zip |
Fix force equality checking not to break the serialized attribute with Array
Context: https://github.com/rails/rails/commit/43ef00e5d7a55ad79bc840276d33cb70f1f5dde5#commitcomment-29256140
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/type/serialized.rb | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 4a4ceca782..f734cd0ad8 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -48,7 +48,6 @@ module ActiveRecord end def build(attribute, value) - # FIXME: Deprecate this and provide a public API to force equality if table.type(attribute.name).force_equality?(value) bind = build_bind_attribute(attribute.name, value) attribute.eq(bind) diff --git a/activerecord/lib/active_record/type/serialized.rb b/activerecord/lib/active_record/type/serialized.rb index e882784691..0a2f6cb9fb 100644 --- a/activerecord/lib/active_record/type/serialized.rb +++ b/activerecord/lib/active_record/type/serialized.rb @@ -51,6 +51,10 @@ module ActiveRecord end end + def force_equality?(value) + coder.respond_to?(:object_class) && value.is_a?(coder.object_class) + end + private def default_value?(value) |