OSDN Git Service
(root)
/
pettanr
/
pettanr.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
fix:balloon edit
[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