跳到內容 跳到搜尋
方法
N

執行個體公用方法

no_touching(&區塊)

可在區塊持續期間有選擇性停用呼叫功能 touch

範例

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
# File activerecord/lib/active_record/no_touching.rb, line 23
def no_touching(&block)
  NoTouching.apply_to(self, &block)
end