Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
的rails mysql2 gem错误。是否包括?_Mysql_Ruby On Rails 3 - Fatal编程技术网

的rails mysql2 gem错误。是否包括?

的rails mysql2 gem错误。是否包括?,mysql,ruby-on-rails-3,Mysql,Ruby On Rails 3,这可以在本地工作,但不能在生产服务器上工作 使用ubuntu 10.04、rails 3.0.7、ruby 1.9.2和mysql2 gem 我做错了什么 haml视图: - unless current_user.surveys.include?(survey) 返回 ActionView::Template::Error (Mysql2::Error: You have an error in your SQL syntax; check the manual that correspon

这可以在本地工作,但不能在生产服务器上工作

使用ubuntu 10.04、rails 3.0.7、ruby 1.9.2和mysql2 gem

我做错了什么

haml视图:

- unless current_user.surveys.include?(survey)
返回

ActionView::Template::Error (Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL))) LIMIT 1' at line 1: SELECT  1 FROM `surveys` INNER JOIN `response_sets` ON `surveys`.id = `response_sets`.survey_id WHERE `surveys`.`id` = 1 AND ((`response_sets`.user_id = 1) AND ((completed_at NOT NULL))) LIMIT 1):
编辑 使用一种叫做测量仪的宝石。在不编辑实际gem的情况下,我必须在用户模型中创建这样的关联:

has_many :response_sets
has_many :surveys, :through => :response_sets, :conditions => ["completed_at NOT NULL"]
has_many :responses, :through => :response_sets

DB Tables:

我很确定语法是“不为空”,而不仅仅是“不为空”。我在我的MySQL实例上运行了一个测试,当我漏掉IS时出现了一个错误。请告诉我们如何设置
调查
关联。