跳至内容 跳至搜索

Active Record No Touching

命名空间
方法
N

实例公开方法

no_touching?()

如果类已设置 no_touching,则返回 true,否则返回 false

Project.no_touching do
  Project.first.no_touching? # true
  Message.first.no_touching? # false
end
# File activerecord/lib/active_record/no_touching.rb, line 53
def no_touching?
  NoTouching.applied_to?(self.class)
end