无法绑定Rails 4多部分标识符

时间:2014-06-18 22:05:09

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4

以下ActiveRecord查询导致错误“无法绑定多部分标识符question_answer_response.response_group。”

这从Rails 3.2.x升级到Rails 4.0.x后才开始发生

class Question < ActiveRecord::Base

  def self.fetch_dependencies(section_id)
    self.select('questions.*,question_answer_response.response as response,question_answer_response.response_group as response_group').
         includes({:dependency_conditions => :dependency}).
         where("dependencies.survey_section_id = #{section_id} and questions.survey_section_id != dependencies.survey_section_id")
  end

end

0 个答案:

没有答案