Forum: Ruby on Rails use file column magick only if file is an image ?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
11a08b97f4904999b2398a0c265b38e4?d=identicon&s=25 Frioffol Friofool (friofool)
on 2007-03-16 17:23

I have a model like this :

class Biblio::BibliothequeContent < ActiveRecord::Base

has_many :bibliotheque_content_types

has_many :bibliotheque_dossier_contents

file_column :nom_fichier,:store_dir => "public/files/",:magick => {
:versions => { "thumb" => "50x50","mini" => "200x200", "medium" =>
"640x480>" }}


I just want to use he :magick option only if the uploaded file is in jpg
or gif format.

Maybe a solution with a specific validation ?

This topic is locked and can not be replied to.