在生产环境中运行RoR应用程序的问题

时间:2010-03-12 03:34:00

标签: ruby-on-rails mongrel production-environment

拥有一个包含“商品详情”的应用 - 想想分类广告 - 每个商家信息都有一个代码列表。

当我在生产模式下运行应用程序时,以下代码失败,但在开发模式下正常工作

uninitialized constant ActiveRecord::Acts::Taggable::InstanceMethods::TagList
Extracted source (around line #45):

42:         
43:         <span class="listingIndexTags">
44:             Location: [location] | Tags:
45:             <% tag_list = listing.tag_list %>
46:             <% if tag_list != nil %> 
47:                 <% for tag in tag_list %>
48:                     <%= link_to tag.to_s, { :action => "filter_on",

我在这个测试用例中用来启动我的mongrel实例的命令行: ruby script / server mongrel -e production

默认为端口3000.我可以访问应用程序中不要调用“listing.tag_list”的其他视图。

“。tag_list”由“acts_as_taggable_on_steroids”提供,我正在此应用中使用。它作为宝石安装。

也许我的环境文件很糟糕?

这是我的development.rb文件

config.cache_classes = false

config.whiny_nils = true

config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs                         = true
config.action_controller.perform_caching             = false

config.action_mailer.raise_delivery_errors = true

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  ...took these settings out for this post...
}

我的production.rb文件......

config.cache_classes = true
config.threadsafe!  

config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching             = true

config.cache_store = :mem_cache_store

config.action_mailer.raise_delivery_errors = false

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  ...took these settings out for this post...
}

3 个答案:

答案 0 :(得分:1)

FIXED:

好吧,推迟修复这个bug直到我绝对不得不(今天),我终于找到了问题的根源。

包含该行: config.threadsafe!

在我的“production.rb”文件中导致了它。

I finally found it by:
    1. Making my production and development environment files identical
    2. Line-by-line, changing the production environment file until it either:
      a. The app broke in production mode
      b. I was back to my original production file

无论如何,当我添加“config.threadsafe!”时线 - IT BROKE!我很高兴有一个应用程序休息。

所以,稍微阅读以了解这个选项究竟是什么,与Mongrel结合(如果Mongrel甚至是相关的),我会得到答案。

答案 1 :(得分:1)

带着同样的问题来到这里,只是想给每个遇到同样问题的人发一张纸条....我已经设法通过修复环境中的宝石版本来解决这个问题.rb

改变了这个 config.gem“acts-as-taggable-on”,:source =&gt; “http://gemcutter.org

到此:
config.gem“acts-as-taggable-on”,:source =&gt; “http://gemcutter.org”,:version =&gt; '2.0.0.RC1'

并运行rake gems:install

我想知道如果可能的话,你是否在某种程度上在不同的环境中运行不同的宝石。

答案 2 :(得分:0)

您是否在生产服务器上安装了acts_as_taggable_on_steroids gem?

相关问题