instance method
no_touching
Ruby on Rails 8.0.5.1
Since v4.1.16Signature
no_touching(&block)
Lets you selectively disable calls to touch for the duration of a block.
Examples
ActiveRecord::Base.no_touching do
Project.first.touch # does nothing
Message.first.touch # does nothing
end
Project.no_touching do
Project.first.touch # does nothing
Message.first.touch # works, but does not touch the associated project
end
Parameters
-
blockblock
Source
# File activerecord/lib/active_record/no_touching.rb, line 23
def no_touching(&block)
NoTouching.apply_to(self, &block)
end
Defined in activerecord/lib/active_record/no_touching.rb line 23
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::NoTouching::ClassMethods