OSDN Git Service

t#29312:any update
[pettanr/pettanr.git] / lib / validators / resize_validator.rb
index 59b6265..be01eeb 100644 (file)
@@ -1,6 +1,6 @@
 class ResizeValidator < ActiveModel::EachValidator\r
   def validate_each(record, attribute, value)\r
-    if record.picture.flag_resize < 0\r
+    if record.picture and record.picture.flag_resize < 0\r
       record.errors[attribute] << (options[:message] || "no resize") unless value == record.picture[attribute]\r
     end\r
   end\r