Module: ValidatesAsImage::ClassMethods
- Defined in:
- lib/merrycms/validates_as_image.rb
Instance Method Summary collapse
Instance Method Details
#validates_as_image(fields) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/merrycms/validates_as_image.rb', line 8 def validates_as_image fields validates_each fields do |record, attr, value| if !value.queued_for_write.empty? and value.to_file `identify "#{value.to_file.path}"` record.errors.add attr, I18n.t("activerecord.errors.models.#{record.class.table_name.singularize}.attributes.#{attr}.wrong_format") unless $? == 0 end end end |