OSDN Git Service
(root)
/
pettanr
/
pettanr.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
add natural number validater
[pettanr/pettanr.git]
/
lib
/
validators
/
not_zero_validator.rb
1
class NotZeroValidator < ActiveModel::EachValidator
\r
2
def validate_each(record, attribute, value)
\r
3
record.errors[attribute] << (options[:message] || "is zero") if value.to_i == 0
\r
4
end
\r
5
end
\r
6