vendredi 29 avril 2016

Carrierwave How to uplaoad without extenstion

I want to upload a image (iTunesArtwork) without extension from console, I want to skip validating the image when I upload from console.

I am able to upload it from the UI without any extension added with image.

Model

class App < ActiveRecord::Base
  mount_uploader :itunes_artwork, ItunesArtworkUploader
end

Uploader

class ItunesArtworkUploader < IconBase
DIMENSIONS = [1024, 1024]
def filename
  "iTunesArtwork"
end

def extension_white_list
  ['png', '']
end

end

Console:

> app.remote_itunes_artwork_url = "http://ift.tt/248wGe7
> app.save!
ActiveRecord::RecordInvalid: Validation failed: Itunes artwork must be in png format

Aucun commentaire:

Enregistrer un commentaire