I'm sure this is a common problem, but it has me stumped.
I have a has_many :through table on a 'Step' model:
has_many :questions, :through => :question_step
That question_step model has presence validators on the question_id and step_id fields:
validates_presence_of :question_id, :step_id
And there are checkboxes that determine which questions belong to which step
td= check_box_tag "step[question_ids][]", question.id, @step.question_ids.include?(question.id)
Now, this works just fine, except when I want to add questions to a new step. Because step_id is blank, the question_step model fails validation. It works fine if I remove the validate_presence_of :step_id argument in the question_step model, but I actually do want to ensure that the step_id is there.
I'm sure this is a common problem. ...Any thoughts?