Capistrano 3 在部署时不设置 rails_env 和阶段

Capistrano 3 don't set rails_env and stage on deploy

Capfile

require "capistrano/setup"
require "capistrano/deploy"

require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

require 'capistrano/rails'
require 'capistrano/passenger'

require 'capistrano/rvm'
set :rvm_type, :user
set :rvm_ruby_version, '2.5.1'

Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

staging.rb

server 'IP', user: 'deploy', roles: %w{app db web}
set :deploy_to, '/home/deploy/project-name'
set :stage, :staging
set :rails_env, "staging"

deploy.rb

set :application, "project-name"
set :repo_url, "git@bitbucket.org:url"

append :linked_files, "config/database.yml", "config/secrets.yml"
append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "vendor/bundle", "public/system", "public/uploads"

之后
cap staging deploy

网站给我这个错误:

'development' database is not configured. Available: ["staging"] (ActiveRecord::AdapterNotSpecified)

我尝试在 Internet 上研究问题但没有结果,应用程序始终设置为开发

我的天啊我有

rails_env development;

已安装

rails_env staging;

在/etc/nginx/sites-enabled/default文件中