Spec-Zone.ru › Ruby on Rails 8.1

module ActiveRecord::NoTouching::ClassMethods

Открытые методы экземпляра

no_touching (&block) Показать исходный код
# File activerecord/lib/active_record/no_touching.rb, line 23
def no_touching(&block)
  NoTouching.apply_to(self, &block)
end

Позволяет выборочно отключить вызовы 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

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API