我在 rubymine 中使用 ruby on rails 创建了一个应用程序。我在 Windows pc 上做了它,它工作。现在我将它转移到一台装有 Ubuntu 的电脑上,并使用本教程安装了 ubuntu 。现在,当我在 localhost:3000 上调用 rails server 以及在浏览器中转到该页面时,我遇到了错误。
Puma caught this error: Missing `secret_key_base` for 'development' environment, set this value in `config/secrets.yml` (RuntimeError)
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.3/lib/rails/application.rb:513:in `validate_secret_key_config!'
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.3/lib/rails/application.rb:246:in `env_config'
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.3/lib/rails/engine.rb:693:in `build_request'
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.3/lib/rails/application.rb:521:in `build_request'
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.3/lib/rails/engine.rb:521:in `call'
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.2/lib/puma/configuration.rb:224:in `call'
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.2/lib/puma/server.rb:600:in `handle_request'
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.2/lib/puma/server.rb:435:in `process_client'
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.2/lib/puma/server.rb:299:in `block in run'
/home/fangio/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.2/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
我怎样才能轻松解决这个问题?我是一个 Ubuntu 新手。
它清楚地说明了缺少什么以及在哪里。您需要打开“config/secrets.yml”并添加开发环境的密钥
U 可以使用 irb 生成随机密钥:
irb(主):003:0>
然后将该长字符串复制到秘密文件中