2015-12-27 141 views
0

Rails 4.1.5 ruby 2.1.2p95 MongoDB - 2.4.13Rails應用程序的Heroku錯誤

它在本地系統文件但是當deplying的Heroku它給出了問題

mongodb.yml

production: 
    sessions: 
    default: 
     uri: <%= ENV['MONGOHQ_URL'] %> 
     options: 
     consistency: :strong 
     max_retries_on_connection_failure: 20 
     persist_in_safe_mode: true 
     skip_version_check: true 

這裏Heroku的日誌

> 2015-12-27T11:48:46.350015+00:00 app[web.1]: Processing by UsersController#index as HTML 
2015-12-27T11:48:48.870124+00:00 heroku[router]: at=info method=GET path="/users" host=lit-fjord-5279.herokuapp.com request_id=02419aa9-43c9-4446-b8e9-8a9f7a441b40 fwd="122.172.61.174" dyno=web.1 connect=13ms service=9ms status=500 bytes=1754 
2015-12-27T11:48:48.870017+00:00 app[web.1]: Started GET "/users" for 122.172.61.174 at 2015-12-27 11:48:48 +0000 
2015-12-27T11:48:48.873238+00:00 app[web.1]: Rendered users/index.html.erb within layouts/application (0.9ms) 
2015-12-27T11:48:48.873359+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms 
2015-12-27T11:48:48.874438+00:00 app[web.1]: 
2015-12-27T11:48:48.874441+00:00 app[web.1]: ActionView::Template::Error (
2015-12-27T11:48:48.874442+00:00 app[web.1]: message: 
2015-12-27T11:48:48.874443+00:00 app[web.1]: No configuration could be found for a client named 'default'. 
2015-12-27T11:48:48.874444+00:00 app[web.1]: summary: 
2015-12-27T11:48:48.874445+00:00 app[web.1]: When attempting to create the new client, Mongoid could not find a client configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect. 
2015-12-27T11:48:48.874446+00:00 app[web.1]: resolution: 
2015-12-27T11:48:48.874446+00:00 app[web.1]: Double check your mongoid.yml to make sure under the clients key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.): 
2015-12-27T11:48:48.874447+00:00 app[web.1]:  10: </thead> 
2015-12-27T11:48:48.874450+00:00 app[web.1]:  14:  <tr> 
2015-12-27T11:48:48.874450+00:00 app[web.1]:  15:   <td><%= user.name %></td> 
2015-12-27T11:48:48.874451+00:00 app[web.1]:  16:   <td><%= user.email %></td> 
2015-12-27T11:48:48.874448+00:00 app[web.1]:  11: 
2015-12-27T11:48:48.874448+00:00 app[web.1]:  12: <tbody> 
2015-12-27T11:48:48.874449+00:00 app[web.1]:  13:  <% @users.each do |user| %> 
2015-12-27T11:48:48.874452+00:00 app[web.1]: app/views/users/index.html.erb:13:in `_app_views_users_index_html_erb__1900358265610175239_69916668256060' 
2015-12-27T11:48:48.874453+00:00 app[web.1]: 
2015-12-27T11:48:48.874453+00:00 app[web.1]: 

回答

0

錯誤:

Double check your mongoid.yml to make sure under the clients key that a configuration exists for 'default'

文件名:

mongodb.yml

這些事情之一是不喜歡對方。嘗試將文件重命名爲mongoid.yml

Mongoid Tutorial, configuration