1
我補充生產數據庫,如下所示:當試圖創建新的客戶端,Mongoid找不到名稱的客戶端配置:「默認」
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
options:
consistency: :strong
max_retries: 1
retry_interval: 0
取決於以下docs。
我用以下命令創建MONGOHQ_URL
:
heroku config:add MONGOHQ_URL=mongodb://user:[email protected]:port/db_name
但是當我通過heroku run rails c
打開控制檯。我有以下幾點:
There is a configuration error with the current mongoid.yml.
message:
No clients configuration provided.
summary:
Mongoid's configuration requires that you provide details about each client that can be connected to, and requires in the clients config at least 1 default client to exist.
resolution:
Double check your mongoid.yml to make sure that you have a top-level clients key with at least 1 default client configuration for it. You can regenerate a new mongoid.yml for assistance via `rails g mongoid:config`.
Example:
development:
clients:
default:
database: mongoid_dev
hosts:
- localhost:27017
Loading production environment (Rails 4.2.4)
我怎樣才能在mongoid.yml
文件中添加生產配置中使用Heroku的部署?
有一個可能的重複[here](http://stackoverflow.com/questions/24369990/rails-environment-mongoid-connection-issue) – alexunger