开发者

Mysql2::Error: Operand should contain 1 column(s)

开发者 https://www.devze.com 2023-03-12 14:07 出处:网络
This line in my controller: 开发者_StackOverflow中文版@feedback = Feedback.where(\"reviewer_id = ?, reviewee_id = ?, strength_id = ?\", current_user.id, @report_for.id, @context ).first

This line in my controller:

开发者_StackOverflow中文版@feedback = Feedback.where("reviewer_id = ?, reviewee_id = ?, strength_id = ?", current_user.id, @report_for.id, @context ).first

produces this error when I attempt to display @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


I think your SQL is wrong, try this

@feedback = Feedback.where("reviewer_id = ? and reviewee_id = ? and strength_id = ?", current_user.id, @report_for.id, @context ).first
0

精彩评论

暂无评论...
验证码 换一张
取 消