Rails generate dragonfly returns undefined method `public_key = 'for # <Recaptcha after switching from Heroku to a dedicated server
The site was transferred from Heroku to a dedicated Ubuntu server and after the migration site worked fine, with the exception of images hosted on S3.
When loading pages with images, the following error type is returned to it:
Completed 200 OK in 1428.8ms (Views: 505.5ms | ActiveRecord: 322.2ms)
Started GET "/system/images/W1siZiIsIjIwMTYvMDkvMjIvMTMvMjQvMjUvMjE1L05hb21pX1NhbnNvbS5qcGciXSxbInAiLCJ0aHVtYiIsIjM2MHgzNjAjIl1d/picture.jpg" for ip at 2016-11-23 00:27:24 +0000
Dragonfly::Configurable::NotConfigured (You need to configure Dragonfly::DataStorage::S3DataStore with bucket_name):
I see that the application did not have the dragonfly specified in the gemfile, since Heroku seems to do something completely different and reinstall dragonfly, but when trying to create a configuration file, the following error is returned.
# rails generate dragonfly
appdir/config/initializers/recaptcha.rb:2:in `block in <top (required)>': undefined method `public_key=' for #<Recaptcha::Configuration:0x0000000521f070> (NoMethodError)
from appdir/vendor/bundle/ruby/2.0.0/gems/recaptcha-4.0.0/lib/recaptcha.rb:30:in `configure'
from appdir/config/initializers/recaptcha.rb:1:in `<top (required)>'
from appdir/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `load'
from appdir/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `block in load'
from appdir/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:in `load_dependency'
from appdir/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `load'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/engine.rb:592:in `each'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/engine.rb:592:in `block in <class:Engine>'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/initializable.rb:30:in `instance_exec'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/initializable.rb:30:in `run'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/initializable.rb:55:in `block in run_initializers'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/initializable.rb:54:in `each'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/initializable.rb:54:in `run_initializers'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/application.rb:136:in `initialize!'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/railtie/configurable.rb:30:in `method_missing'
from appdir/config/environment.rb:5:in `<top (required)>'
from appdir/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `require'
from appdir/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `block in require'
from appdir/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:in `load_dependency'
from appdir/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `require'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/application.rb:103:in `require_environment!'
from appdir/vendor/bundle/ruby/2.0.0/gems/railties-3.2.18/lib/rails/commands.rb:25:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Recaptcha itself works fine, and the batch installation did not return any errors, but I cannot get dragonfly to work.
recaptcha.rb is as follows
Recaptcha.configure do |config|
config.public_key = 'public key'
config.private_key = 'private key'
config.api_version = 'v2'
end
.env, , :
export RECAPTCHA_PUBLIC_KEY = 'public key'
export RECAPTCHA_PRIVATE_KEY = 'private key'
config/environment/production.rb config/environment/development.rb :
recaptcha_public_key= "[PUBLIC KEY]"
recaptcha_private_key= "[PRIVATE KEY]"
, , - dragonfly recaptcha Heroku Linux.