1

Tout fonctionne bien en mode développement, mais quand je tente de démarrer mon application en mode production (RAILS_ENV = scénario production/serveur) Je reçois l'erreur suivante:Ruby on Rails App ne démarre pas en mode de production

/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'... 

Maintenant, il me semble que la gemme acts_as_commentable cause cela. Mais comment ça se fait, ça marche bien en mode développement.

+1

voir comment.rb (vers la ligne 2) – fl00r

Répondre

1

J'ai trouvé l'erreur grâce au commentaire de fl00r:

show comment.rb (around line 2)

ligne 2 comment.rb était include ActsAsCommentable::Comment. Cela m'a semblé un peu étrange, alors j'ai jeté un coup d'oeil à la documentation officielle pour la gemme acts_as_commentable. C'était le problème. Il aurait dû être acts_as_commentable à la place. Doit avoir copié-collé de quelque part.

Pourtant, le mystère reste comment il aurait pu fonctionner en mode développement. En raison de la mise en cache de classe mentionnée par annaswims?

1

En mode Développement, les classes sont chargées au fur et à mesure de vos besoins. En production, ils sont mis en cache lorsque les rails commencent.

Questions connexes