I’m really stumped here. I’m new to Rails and I’m sure I’m doing
something stupid but what’s going on seems like voodoo or something.
When you click on “new match” the controller makes a call to set up
two new objects to be populated. You’re brought to your form (see
figure 1). When you submit a form with improper validation, typically
things work fine - validation errors show up and you are returned to
the form with the two objects populated with what you had, and the
errors display (see figure 2.)
The part that has me so stumped is that when you happen to check the
“home” checkbox and you submit, I end up with an extra object created
when validation fails! (see figure 3, you’ll see the extra player game
object column.) I have no idea why, and I have no idea why selecting
this checkbox causes it to happen? Why does only this form field cause
the problem and not the other form fields???
figure 1: http://img.skitch.com/20081209-kcbuias6u29g4ce8a3wuyu6xcf.jpg
figure 2: http://img.skitch.com/20081209-1ceh84wc8dnisfjuiimw7fk9qe.jpg
figure 3: http://img.skitch.com/20081209-gwk2ib89c2kfm1hhs3ymh7fc4e.jpg
Can someone give me some tips as to what even might be wrong or where
I should start to look? I have some log statements and the same flow
seems to happen regardless of the scenario.
I posted the main controller and a few other things that I think might
be relevant here http://pastie.org/335194 in case anyway wants to help
by taking a look.