module ActiveModel module Validations class VerityValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add(attribute, :verity, :message => options[:message], :value => value) unless value.is_a?(TrueClass) end end module HelperMethods def validates_verity_of(*attr_names) validates_with VerityValidator, _merge_attributes(attr_names) end alias validates_truth_of validates_verity_of end end end