class Product include Mongoid::Document validate :check_scope def check_scope errors.add(:base, 'ddd') end end
check_scope 如果直接返回 false, 或者 errors.add Product.create 无论如何都会通过