我的控制器中的这一行:
@feedback = Feedback.where("reviewer_id = ?, reviewee_id = ?, strength_id = ?", current_user.id, @report_for.id, @context ).first
当我尝试显示@feedback.something
:时,会产生此错误
Mysql2::Error: Operand should contain 1 column(s): SELECT `feedbacks`.* FROM `feedbacks` WHERE (reviewer_id = 1, reviewee_id = 10, strength_id = 0) LIMIT 1
答案 0 :(得分:3)
我认为你的SQL错了,试试这个
@feedback = Feedback.where("reviewer_id = ? and reviewee_id = ? and strength_id = ?", current_user.id, @report_for.id, @context ).first