OSDN Git Service

t#30307:change valid message for custom validator
[pettanr/pettanr.git] / lib / validators / not_zero_validator.rb
index 8d4389b..b65d807 100644 (file)
@@ -1,6 +1,6 @@
 class NotZeroValidator < ActiveModel::EachValidator\r
   def validate_each(record, attribute, value)\r
-    record.errors[attribute] << (options[:message] || "is zero") if value.to_i == 0\r
+    record.errors[attribute] << (options[:message] || I18n.t('activerecord.errors.messages.not_zero')) if value.to_i == 0\r
   end\r
 end\r
-
+\r