Hi,
I am trying to do the following database query (ie find all question
id’s with the selected minisection id):
minisection_questions = Question.where(minisection_id:
minisection_id).pluck(:id)
I have a question table, a minisection table, and a
minisections_questions join table.
Question model - has_and_belongs_to_many :minisections
Minisection model - has_and_belongs_to_many :questions
I get the following error:
PGError: ERROR: column questions.minisection_id does not exist
LINE 1: SELECT id FROM “questions” WHERE “questions”."minisection_i…
^
: SELECT id FROM “questions” WHERE “questions”.“minisection_id” = 2
Also tried minisection_questions =
Question.where(question.minisection_id:
minisection_id).pluck(:id) and got the folowing:
error:undefined local variable or method `question’ for
#DrillsController:0x00000103049710
Thanks,
Dave