Permalink
Browse files

Pass along original attribute to save later recursion

Fixes #26122
  • Loading branch information...
tenderlove committed Aug 14, 2016
1 parent fb99a48 commit b6c0bc9c8a6a6dc86b315566e3ab52acc1a5377d
Showing with 8 additions and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/attribute.rb
  2. +7 −0 activerecord/test/cases/base_test.rb
@@ -65,7 +65,7 @@ def forgetting_assignment

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)
@@ -115,6 +115,13 @@ def test_limit_with_comma
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

0 comments on commit b6c0bc9

Please sign in to comment.