我有Rails和mongodb的一個小問題。我有一個小應用程序,它在開發模式下非常出色。它也適用於生產模式,但是當我進入導軌控制檯時,我看不到任何東西。Rails控制檯和mongodb
[email protected]:/var/www/webapp% rails c RAILS_ENV="production"
You did not specify how you would like Rails to report deprecation notices for your RAILS_ENV=production environment, please set config.active_support.deprecation to :log, :notify or :stderr at config/environments/RAILS_ENV=production.rb
Loading RAILS_ENV=production environment (Rails 3.2.1)
1.9.3p0 :001 > User.all
=> []
我的配置/初始化/ mongo.rb看起來像這樣
MongoMapper.connection = Mongo::Connection.new('localhost', 27017)
MongoMapper.database = "webapp-#{Rails.env}"
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
MongoMapper.connection.connect if forked
end
end
,但它也看起來空
$ mongo localhost:27017/mail1up-production
MongoDB shell version: 1.8.2
Fri Feb 17 18:26:00 *** warning: spider monkey build without utf8 support. consider rebuilding with utf8 support
connecting to: localhost:27017/webapp-production
> db.mycollection.stats()
{ "errmsg" : "ns not found", "ok" : 0 }
>
難道我做錯了什麼?爲什麼我無法看到數據庫中的數據?我如何測試它?
你有沒有搞清楚問題? – 2012-02-22 17:58:15