David Lojudice Sb. David Lojudice Sb. - 2 months ago 10x
Ruby Question

Paperclip, fog.io and Rackspace

I'm trying to find documentations on how to setup Paperclip to use fog.io and fog.io to use Rackspace Cloud File, but I wasn't able to find any good reference (and I consider myself a good Google language speaker :D). The ideal scenario would be a setup where I could use local storage for a development environment and Rackspace for production.

Could anyone point to a good doc or use this space to document this approach?


== Update ==:

Paperclip to fog.io


fog.io to Rackspace Cloud File


... still trying to figure out how to put these together.


I think I got it.

On config/initializers/paperclip_defaults.rb

  :path => "images/:class/:id/:attachment/:style/img_:fingerprint",
  :storage => :fog,
  :fog_credentials => {
    :provider           => 'Rackspace',
    :rackspace_username => 'blablabla',
    :rackspace_api_key  => 'blablabla',
    :persistent => false
  :fog_directory => 'blablabla',
  :fog_public => true,
  :fog_host => 'http://blablabla.rackcdn.com'


:fog_directory - This is your Rackspace Cloud File container.

:fog_host - The Cloud File CDN URL

:persistent - To prevent a bug on Fog/Excon. You may not need this on the future.

Also use :fingerprint paperclip feature to avoid CDN cache when you update the file.