Używam następujący:Jak ustawić styl Paperclip działa tylko wtedy, gdy contenttype jest obrazem?
has_attached_file :file,:styles => { :thumbnail => '320x240!'},:url => "/images/:attachment/:id/:style/:basename.:extension",:path => ":rails_root/public/images/:attachment/:id/:style/:basename.:extension"
validates_attachment_content_type :file, :content_type => [ 'image/gif', 'image/png', 'image/x-png', 'image/jpeg', 'image/pjpeg', 'image/jpg' ]
Aby przesłać oba obrazy i wideo. Jeśli użyję :style =>{}
, obraz nie zostanie przesłany. Chcę użyć metody :style
tylko wtedy, gdy typem zawartości pliku jest obraz.
powinieneś używać before_post_process https://github.com/thoughtbot/paperclip#events –