1

一切都在發展模式下工作正常,但是當我嘗試啓動我的生產模式(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

回答

1

我發現錯誤感謝fl00r的評論:

show comment.rb (around line 2)

2號線在comment.rb是include ActsAsCommentable::Comment。這對我來說似乎有點奇怪,所以我看了一下acts_as_commentable gem的官方文檔。這是問題所在。它應該是acts_as_commentable。必須從某處複製粘貼它。

儘管如此,它仍然可以在開發模式下工作。由於annaswim提到的類緩存?

1

在開發模式下,類會在您需要時加載。在生產中,它們在導軌啓動時被緩存。

相關問題