I have a question model which can be created using the ckeditor gem with Paperclip.
Each question can contain several attached pictures.
Each question has several answers and each answer can contain several attached pictures too (answers are created with ckeditor too).
The configuration for my ckeditor uploaded pictures is the following :
class Ckeditor::Picture < Ckeditor::Asset
has_attached_file :data,
:storage => :s3,
:url => ":s3_eu_url",
:s3_credentials => "path to credentials",
:path => ":class/:id/:basename.:extension",
:styles => { :medium => "500x500>",
:thumb => "500x500>"},
:s3_protocol => 'http'
validates_attachment_size :data, :less_than => 2.megabytes
validates_attachment_presence :data
def url_content
url(:content)
end
end
With that configuration I do not know how to identify the pictures attached to a given question or answer. The aim is to remove the pictures from s3 when the question or the answer is deleted.
As I did not succeed in finding a solution to this problem using Paperclip, I start to use carrierwave that provides this functionality.