rails/activestorage

Problem with config.active_storage.service in environment files

Closed this issue · 1 comments

Hello, could anyone help me with the following problem?

i configure a simple rails app:

Ruby 2.4.1
Rails 5.1.2

Added the gem "activestorage" in Gemfile:

gem 'activestorage', github: 'rails/activestorage'

Added require "active_storage" to config/application.rb, after require "rails/all" line.

Runned rails activestorage:install;

I tried Configure the storage service in config/environments/* with config.active_storage.service = :local. When i start the server, dont work.

/Users/rafaeldl/.rbenv/versions/2.4.1/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/rafaeldl/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/ruby-debug-ide-0.6.1.beta4/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 55802 --host 0.0.0.0 --dispatcher-port 55803 -- /Users/rafaeldl/Projetos/babytube-web/bin/rails db:migrate Fast Debugger (ruby-debug-ide 0.6.1.beta4, debase 0.2.2.beta10, file filtering is supported) listens on 0.0.0.0:55802 rails aborted! NoMethodError: undefined method[]' for nil:NilClass
(erb):12:in <main>' /Users/rafaeldl/Projetos/babytube-web/config/environment.rb:5:in <top (required)>'
/Users/rafaeldl/Projetos/babytube-web/bin/rails:9:in require' /Users/rafaeldl/Projetos/babytube-web/bin/rails:9:in <top (required)>'
-e:1:in load' -e:1:in

'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
`

I found the solution:

  1. Make a copy of your config/storage_services.yml file to config/storage_services_backup.yml. Then delete the amazon, google, and mirror sections from the original file. Otherwise, your server won't start, because it will be looking for keys and files that don't exist.

Solution: step 7

Thanks.