Hi,
I'm using habtm to create a relationship between two models:
class Question < ActiveRecord::Base
has_and_belongs_to_many :exams
end
class Exam < ActiveRecord::Base
has_and_belongs_to_many :questions
end
At some point I'm doing this:
class Exam < ActiveRecord::Base
has_and_belongs_to_many :questions
def generate
(1..5).each do
questions.create(Question::SKELETON)
end
end
end
When I do that, a sql inserts a record inside questions_exams table.
But this table has another column called: 'order' where I need to put some data inside
How can I populate the 'order' column inside join table ?
questions_exams
- question_id
- exam_id
- order
Thanks.