的Ruby on Rails应用程序不是在生产模式下启动

问题描述:

一切都在发展模式下工作正常,但是当我尝试启动我的生产模式(RAILS_ENV =制作脚本/服务器),我收到以下错误应用:的Ruby on Rails应用程序不是在生产模式下启动

/opt/ruby1.8/lib/ruby/gems/1.8/gems/searchlogic-2.4.19/lib/searchlogic/named_scopes/conditions.rb:81:in `method_missing': protected method `scope' called for #<Class:0x7f41de524410> (NoMethodError)                        
     from /opt/ruby1.8/lib/ruby/gems/1.8/gems/searchlogic-2.4.19/lib/searchlogic/named_scopes/association_conditions.rb:19:in `method_missing' 
     from /opt/ruby1.8/lib/ruby/gems/1.8/gems/searchlogic-2.4.19/lib/searchlogic/named_scopes/association_ordering.rb:27:in `method_missing' 
     from /opt/ruby1.8/lib/ruby/gems/1.8/gems/searchlogic-2.4.19/lib/searchlogic/named_scopes/ordering.rb:30:in `method_missing'    
     from /opt/ruby1.8/lib/ruby/gems/1.8/gems/searchlogic-2.4.19/lib/searchlogic/named_scopes/or_conditions.rb:28:in `method_missing'   
     from /opt/ruby1.8/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1959:in `method_missing_without_paginate'   
     from /opt/ruby1.8/lib/ruby/gems/1.8/gems/will_paginate-2.3.12/lib/will_paginate/finder.rb:170:in `method_missing'       
     from /opt/ruby1.8/lib/ruby/gems/1.8/gems/acts_as_commentable-3.0.0/lib/comment_methods.rb:12:in `included'         
     from .../app/models/comment.rb:2:in `include'               
     from .../app/models/comment.rb:2                   
     from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'           
     from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'... 

现在在我看来,acts_as_commentable宝石正在造成这种情况。但是如何来,它在开发模式下运行良好。

+1

show comment.rb(在第2行左右) – fl00r 2010-05-12 17:40:30

我发现错误感谢fl00r的评论:

show comment.rb (around line 2)

2号线在comment.rb是include ActsAsCommentable::Comment。这对我来说似乎有点奇怪,所以我看了一下acts_as_commentable gem的官方文档。这是问题所在。它应该是acts_as_commentable。必须从某处复制粘贴它。

尽管如此,它仍然可以在开发模式下工作。由于annaswim提到的类缓存?

在开发模式下,类会在您需要时加载。在生产中,它们在导轨启动时被缓存。