mardi 7 septembre 2021

ArgumentError in ImagesController#index / Unknown validator: 'AttachedValidator'

I got this error , while uploading (.cdr) file format

please help me out...

Models/imgae.rb

class Image < ApplicationRecord
   validates :avatar, attached: true

   has_one_attached :avatar

   validates :avatar, attached: true, dimension: { width: { min: 800, max: 2400 } },
   content_type: [:cdr], size: { less_than: 100.kilobytes , message: 'is not given between size' }

     
def self.import(file)
        CSV.foreach(file.path, headers: true) do |row|
          Image.create! row.to_hash
     end
end
end

Aucun commentaire:

Enregistrer un commentaire