OSDN Git Service

be01eeb6d17a56948fa46f4264491087a9414e21
[pettanr/pettanr.git] / lib / validators / resize_validator.rb
1 class ResizeValidator < ActiveModel::EachValidator\r
2   def validate_each(record, attribute, value)\r
3     if record.picture and record.picture.flag_resize < 0\r
4       record.errors[attribute] << (options[:message] || "no resize") unless value == record.picture[attribute]\r
5     end\r
6   end\r
7 end\r
8 \r