OSDN Git Service

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