Class: Refinery::Images::Validators::ImageUpdateValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
images/lib/refinery/images/validators/image_update_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object


6
7
8
9
10
11
12
# File 'images/lib/refinery/images/validators/image_update_validator.rb', line 6

def validate(record)
  if record.image_name_changed?
    record.errors.add :image_name,
      ::I18n.t("different_file_name",
               :scope => "activerecord.errors.models.refinery/image")
  end
end