1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Pass along original attribute to save later recursion

Fixes #26122
This commit is contained in:
Aaron Patterson 2016-08-14 14:39:04 -07:00
parent fb99a48b06
commit b6c0bc9c8a
No known key found for this signature in database
GPG key ID: 953170BCB4FFAFC6
2 changed files with 8 additions and 1 deletions

View file

@ -65,7 +65,7 @@ module ActiveRecord
def with_value_from_user(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
def with_value_from_database(value)

View file

@ -115,6 +115,13 @@ class BasicsTest < ActiveRecord::TestCase
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
assert_equal 1, Topic.limit("1").to_a.length
assert_equal 1, Topic.limit(1).to_a.length