Hi, I have a form, that after submit saves data in 2 different tables. It works fine, only in the member-table there is an extra record added, each time the user submits data, with in the rubric_idfield NULL. I checked the parsed data, and they are fine, no extra anything. Should be simple but I cannot pinpoint it. Please, if you could spare some time...
Code:
Action = Combination.transaction do @members.combination = @combination @combination.add_rubrics(@rubrics) @combination.save @members.save end
add_rubrics =
def add_rubrics(rubrics) rubrics.items.each do |item| li = Member.new_rubric(item) members << li end end
new_rubric(item)=
def self.new_rubric(item) li = self.new li.rubric_id = item.id li end I'm convinced it has to be here, but I don't know why it happens.