Ruby on rails 3 Mongoid代码在生产中不起作用

Ruby on rails 3 Mongoid代码在生产中不起作用,ruby-on-rails-3,mongodb,mongoid,Ruby On Rails 3,Mongodb,Mongoid,下面的代码在开发中非常有用,但在生产中,数据库永远不会更新。基本上,我正在尝试更新嵌套在3层深处的集合元素 def set_collection_value

下面的代码在开发中非常有用,但在生产中,数据库永远不会更新。基本上,我正在尝试更新嵌套在3层深处的集合元素

def set_collection_value                                                                                                                                                                          
    @article = Article.find(params[:id])                                                                                                                                                            
    @article.highlights.items.find(params[:item_id])                                                                                                                                                              
    item.update_attributes(params[:values])                                                                                                                                                         

    render :json => item                                                                                                                                                                            
  end 
有关的示范文章如下所示:

class Article
  include Mongoid::Document

  embeds_one :highlight, class_name: 'Highlight'
end
突出显示.rb

class Highlight
  includes Mongoid::Document
  embedded_in :article

  embeds_many :items, class_name: 'HighlightElement'
end
class HighlightElement                                                                                                                                                                              
  include Mongoid::Document                                                                                                                                                                         

  embedded_in :highlight                                                                                                                                                                            

  field :title, type: String                                                                                                                                                                        
  field :teaser, type: String                                                                                                                                                                       
  field :image, type: String                                                                                                                                                                        
  field :body, type: String                                                                                                                                                                         

  attr_accessible :title, :teaser, :image, :body                                                                                                                                                    
end
突出显示项目.rb

class Highlight
  includes Mongoid::Document
  embedded_in :article

  embeds_many :items, class_name: 'HighlightElement'
end
class HighlightElement                                                                                                                                                                              
  include Mongoid::Document                                                                                                                                                                         

  embedded_in :highlight                                                                                                                                                                            

  field :title, type: String                                                                                                                                                                        
  field :teaser, type: String                                                                                                                                                                       
  field :image, type: String                                                                                                                                                                        
  field :body, type: String                                                                                                                                                                         

  attr_accessible :title, :teaser, :image, :body                                                                                                                                                    
end
有趣的是,即使我在本地以生产模式运行webrick,它的工作方式也很有魅力。只有当我部署到运行mongodb v1.2.2的ubuntu服务器上时,上面的代码才会静默地执行任何操作

我甚至把我的
environments/development.rb
复制到我的
environments/production.rb上,希望解决这个问题。。但是没有用

有什么想法吗?我使用mongoid 3.0.3运行rails 3.2.7

如果有人能指出如何使moped/mongoid调试日志消息显示在production.log中,这也会很有帮助。我配置了调试,但这些调试消息只有在运行rails s时才可见,而不是在
生产日志中

原来问题出在官方Ubuntu存储库源代码中的MongoDB1.2.2。
更新到2.0.5后,一切正常。

日志?我怀疑与db没有联系。如果是只读页面,/article/1(猜测)显示的是文章吗?是的。。其他一切都很好。。我甚至可以通过其他方法设置值。。只是这一个不起作用..你知道我怎样才能拿到生产中的轻便摩托车原木吗?我将日志设置为调试,如下所述:但它们不会出现在生产中。日志mongodb日志记录级别与Rails日志记录级别不同;确保在生产服务器上将日志记录级别设置为debug。在rails中将日志记录级别设置为debug后,在控制台上仍然看不到任何mongoid输出:(不过,我确实看到了所有ActiveRecord sql日志