In my initializers/dragonfly.rb
I 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 does开发者_如何学JAVAn't work, app still saving files in local. What I missing?
EDIT: I changed Dragonfly[:app_name]
to Dragonfly[:images]
and it works. Why I need to set :images
, if I can upload any type of files?
When you use the 'dragonfly/rails/images' default settings, it sets Dragonfly[:images] as the app name. See the Dragonfly documentation for how you customize it inside of config/initializers/dragonfly.rb. You could do something like this:
require 'dragonfly'
app = Dragonfly[:app_name]
app.configure_with(:imagemagick)
app.configure_with(:rails)
# ... etc
精彩评论