class ReverseValidator < ActiveModel::EachValidator\r
def validate_each(record, attribute, value)\r
- if record.picture.flag_reverse < 0\r
+ if record.picture and record.picture.flag_reverse < 0\r
record.errors[attribute] << (options[:message] || "no reverse") if value < 0\r
end\r
end\r