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