OSDN Git Service

t#29312:any update
[pettanr/pettanr.git] / lib / validators / sync_vh_validator.rb
index 928d957..04425fd 100644 (file)
@@ -1,6 +1,6 @@
 class SyncVhValidator < ActiveModel::EachValidator\r
   def validate_each(record, attribute, value)\r
-    if record.picture.flag_sync_vh < 0\r
+    if record.picture and record.picture.flag_sync_vh < 0\r
       record.errors[attribute] << (options[:message] || "sync_vh") unless sync?(record)\r
     end\r
   end\r