ralz
ralz

Reputation: 543

"rails generate dragonfly" returns "Could not find generator dragonfly."

I have a site that was migrated from Heroku to standalone server, and everything is working except images which are hosted on S3.

When pages with images is loaded following error is returned.

Started GET "/system/images/W1siZiIsIjIwMTYvMDcvMjIvMTEvMTQvMTUvNzUvSGVhZHNob3RMb2Rub25fRG95bGVDbGF5dG9uX01BWV9BTkQ2NDkzXzFfLmpwZyJdLFsicCIsInRodW1iIiwiMzI2eCJdXQ/picture.jpg" for x.x.x.x at 2016-12-07 04:33:28 +0000

Dragonfly::Configurable::NotConfigured (You need to configure Dragonfly::DataStorage::S3DataStore with bucket_name):

I can see that application didn't have dragonfly listed in gemfile,as Heroku seems to do things a little differently, and have reinstalled dragonfly, but when trying to generate a configuration file following error is returned.

# rails generate dragonfly
Could not find generator dragonfly.

I can see that dragonfly 0.9.15 has been installed.

I have tried manually creating config/initializers/dragonfly.rb with following content, but still get the same error when trying to load images.

require 'dragonfly'

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

app.define_macro(ActiveRecord::Base, :image_accessor)
app.datastore = Dragonfly::DataStorage::S3DataStore.new({
  :bucket_name        => 'S3_BUCKET',
  :access_key_id      => 'S3_KEY',
  :secret_access_key  => 'S3_SECRET',
  :region             => 'S3_REGION'
})

Did anyone had a similar issue.

I am not sure why is "Could not find generator dragonfly" returned.

Upvotes: 1

Views: 78

Answers (0)

Related Questions