Question

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?

Tks!

== Update ==:

Paperclip to fog.io

https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/storage/fog.rb

fog.io to Rackspace Cloud File

http://fog.io/storage/

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

Was it helpful?

Solution

I think I got it.

On config/initializers/paperclip_defaults.rb

Paperclip::Attachment.default_options.update({
  :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'
})

where...

: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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top