OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / lib / validators / natural_number_validator.rb
1 class NaturalNumberValidator < ActiveModel::EachValidator\r
2   def validate_each(record, attribute, value)\r
3     record.errors[attribute] << (options[:message] || I18n.t('activerecord.errors.messages.natural_number')) if value.to_i < 1\r
4   end\r
5 end\r
6 \r