aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-08-26 08:43:04 -0600
committerSean Griffin <sean@thoughtbot.com>2014-08-27 07:13:42 -0600
commit990322b298c41b65be01238c56e2d7ff0dd76cb6 (patch)
tree7a648c78da29603831752316ac150442b153c70e /activerecord/test
parent49b27dba286b0f9536f1f0e366a431b762bf7885 (diff)
downloadrails-990322b298c41b65be01238c56e2d7ff0dd76cb6.tar.gz
rails-990322b298c41b65be01238c56e2d7ff0dd76cb6.tar.bz2
rails-990322b298c41b65be01238c56e2d7ff0dd76cb6.zip
Correctly detect mutation on serialized columns mapping to binary
Fixes #16701
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/dirty_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb
index 0c77eedb52..5cb6b97117 100644
--- a/activerecord/test/cases/dirty_test.rb
+++ b/activerecord/test/cases/dirty_test.rb
@@ -682,6 +682,22 @@ class DirtyTest < ActiveRecord::TestCase
assert_not pirate.changed?
end
+ test "in place mutation for binary" do
+ klass = Class.new(ActiveRecord::Base) do
+ self.table_name = :binaries
+ serialize :data
+ end
+
+ klass.create!(data: "foo")
+ binary = klass.first
+
+ assert_not binary.changed?
+
+ binary.data << "bar"
+
+ assert binary.changed?
+ end
+
private
def with_partial_writes(klass, on = true)
old = klass.partial_writes?