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/test | |
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/test')
-rw-r--r-- | activerecord/test/cases/serialized_attribute_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb index 7764a37273..4cd4515c3b 100644 --- a/activerecord/test/cases/serialized_attribute_test.rb +++ b/activerecord/test/cases/serialized_attribute_test.rb @@ -159,6 +159,13 @@ class SerializedAttributeTest < ActiveRecord::TestCase assert_equal(settings, Topic.find(topic.id).content) end + def test_where_by_serialized_attribute_with_array + settings = [ "color" => "green" ] + Topic.serialize(:content, Array) + topic = Topic.create!(content: settings) + assert_equal topic, Topic.where(content: settings).take + end + def test_where_by_serialized_attribute_with_hash settings = { "color" => "green" } Topic.serialize(:content, Hash) |