有一个应用程序有“列表” – 认为分类广告 – 每个列表都有一个标签列表.
我在生产模式下运行应用程序时,以下代码失败,但在开发模式下正常工作
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脚本/服务器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...
}
最佳答案 固定:
好吧,推迟修复这个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甚至相关),我会得到答案.