class LatitudeValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless value.present? && value >= -90 && value <= 90 record.errors[attribute] << (options[:message] || I18n.t('yukonisuru.errors.messages.latitude')) end end end