class BooleanValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless [true, false, 1, 0].include?(value) record.errors[attribute] << (options[:message] || I18n.t('yukonisuru.errors.messages.boolean')) end end end