【发布时间】:2012-03-15 14:36:31
【问题描述】:
我在我的控制器中接到了这个电话:
@tournaments = Tournament.unignored.all(
:include => [:matches,:sport,:category],
:conditions=> ["matches.status in (0,4)
&& matches.date < ?",
Time.now.end_of_week + 1.day],
:order => "sports.sort ASC, categories.sort ASC, tournaments.sort ASC")
在生产模式和开发控制台中一切正常。但是当我尝试在开发模式下浏览特定页面时,我得到:
评估nil.each时发生错误
当我将创建的SQL 查询粘贴到MySQL 浏览器中时,会有结果。
It refers to mysql2 (0.2.11) lib/active_record/connection_adapters/mysql2_adapter.rb:587:in `select'
这个查询正确到达。
有没有人遇到过类似的问题?这个错误不知从何而来。没有更新等...
谢谢!
Rails 3.0.9 MySql 5.5 Ruby 1.8.7 and mysql2 0.2.11 gem
【问题讨论】:
-
包含的类别搞砸了。仍然不知道为什么它可以在服务器上运行。
标签: mysql ruby-on-rails ruby