I was working on project recently, where I had to use CKeditor with paperclip and amazon s3 as the storage. This all is running on Heroku. The solution is really easy. You have the paperclip in you model
has_attached_file :avatar, :styles => { :big => "180x180#", :medium => "140x140#" }, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => ":attachment/:id/:style.:extension", :url => ":s3_domain_url"
And you have something like this in the picture.rb and attachment_file.rb (app/model/ckeditor/)
has_attached_file :data, :url => "/ckeditor_assets/attachments/:id/:filename", :path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
So solution is obvious now:
has_attached_file :data, :styles => { :big => "180x180#", :medium => "140x140#"}, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => ":attachment/:id/:style.:extension", :url => ":s3_domain_url"
That’s it.
Leave a Reply