How to install Dragonfly for use with S3?

In mine initializers/dragonfly.rbI will put this:

require 'dragonfly/rails/images'

app = Dragonfly[:app_name]
app.datastore = Dragonfly::DataStorage::S3DataStore.new({
  :bucket_name        => 'bucket_name',
  :access_key_id      => 'key...',
  :secret_access_key  => 'key...'
})

But it doesn’t work, the application still saves files locally. What am I missing?

EDIT: I changed Dragonfly[:app_name]to Dragonfly[:images]and it works. Why do I need to install :imagesif I can download files of any type?

+3
source share
1 answer

When you use the default settings "dragonfly / rails / images", it sets Dragonfly [: images] as the application name. See the Dragonfly documentation for how you configure it inside config / initializers / dragonfly.rb. You can do something like this:

  require 'dragonfly'

  app = Dragonfly[:app_name]
  app.configure_with(:imagemagick)
  app.configure_with(:rails)

  # ... etc
0
source

All Articles