Pass along original attribute to save later recursion

Fixes #26122
上级 fb99a48b
...@@ -65,7 +65,7 @@ def forgetting_assignment ...@@ -65,7 +65,7 @@ def forgetting_assignment
def with_value_from_user(value) def with_value_from_user(value)
type.assert_valid_value(value) type.assert_valid_value(value)
self.class.from_user(name, value, type, self) self.class.from_user(name, value, type, original_attribute || self)
end end
def with_value_from_database(value) def with_value_from_database(value)
......
...@@ -115,6 +115,13 @@ def test_limit_with_comma ...@@ -115,6 +115,13 @@ def test_limit_with_comma
end end
end end
def test_many_mutations
car = Car.new name: "<3<3<3"
car.engines_count = 0
20_000.times { car.engines_count += 1 }
assert car.save
end
def test_limit_without_comma def test_limit_without_comma
assert_equal 1, Topic.limit("1").to_a.length assert_equal 1, Topic.limit("1").to_a.length
assert_equal 1, Topic.limit(1).to_a.length assert_equal 1, Topic.limit(1).to_a.length
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册