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

ActiveRecord::Base.no_touching no longer triggers callbacks or start empty transactions.

Closes #14841.
This commit is contained in:
Lucas Mazza 2014-04-22 23:37:13 -05:00
parent d10e2ca9f1
commit 4866399054
3 changed files with 27 additions and 2 deletions

View file

@ -1,3 +1,9 @@
* `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
Fixes #14841.
*Lucas Mazza*
* Fix name collision with `Array#select!` with `Relation#select!`. * Fix name collision with `Array#select!` with `Relation#select!`.
Fixes #14752. Fixes #14752.

View file

@ -296,7 +296,6 @@ module ActiveRecord #:nodoc:
include Core include Core
include Persistence include Persistence
include NoTouching
include ReadonlyAttributes include ReadonlyAttributes
include ModelSchema include ModelSchema
include Inheritance include Inheritance
@ -318,6 +317,7 @@ module ActiveRecord #:nodoc:
include NestedAttributes include NestedAttributes
include Aggregations include Aggregations
include Transactions include Transactions
include NoTouching
include Reflection include Reflection
include Serialization include Serialization
include Store include Store

View file

@ -170,6 +170,25 @@ class TimestampTest < ActiveRecord::TestCase
assert !@developer.no_touching? assert !@developer.no_touching?
end end
def test_no_touching_with_callbacks
klass = Class.new(ActiveRecord::Base) do
self.table_name = "developers"
attr_accessor :after_touch_called
after_touch do |user|
user.after_touch_called = true
end
end
developer = klass.first
klass.no_touching do
developer.touch
assert_not developer.after_touch_called
end
end
def test_saving_a_record_with_a_belongs_to_that_specifies_touching_the_parent_should_update_the_parent_updated_at def test_saving_a_record_with_a_belongs_to_that_specifies_touching_the_parent_should_update_the_parent_updated_at
pet = Pet.first pet = Pet.first
owner = pet.owner owner = pet.owner