0

i am fairly new to rails and want to take advantage of the associations ActiveRecord provides in trying to set up a new project and schema. i have two models, users and questions. when a user is being set up by an administrative user, i have a form with checkboxes for a list of categories. i want these categories to map to specific questions to ask the setup user at a later time. my thinking is i have a mapping table, user_to_categories, that will allow me to get from the user to the necessary questions. but the questions table will have a primary key of question_id, so the has_many :through does not seem to work here. since many questions can be in the same category, category_id will just be another column in the questions table. any suggestions on how to set this up to take advantage of rails and active record associations?

Austin
  • 1,129
  • 2
  • 11
  • 18

1 Answers1

0

Many to Many between user and categories and question belongs to category. Now when you add user select categories by passing category_ids through UI,

Amar
  • 6,874
  • 4
  • 25
  • 23
  • not sure i understand. i don't have a category model and am not sure i want to create one since category is really just a property of the question model. the way you are suggesting would require a category model, correct? – Austin Sep 07 '12 at 22:25