Finally figured out the elusive bug that’s been bothering me all day. In my code, I create an instance of my Family class (this is as I’m importing a GEDCOM into the database), which basically creates a record in the Families table. I kept trying to set the instance’s husband_id and wife_id variables (which map to columns in the table), but inevitably they’d end up as null. So I tried “script/console” and set the variables there. It did change the variables, but the database remained unchanged. (“script/console” is pretty darn nice, I must admit.) I’d been under the impression that changes made to Active Record objects would get made in the database as well, but I began to suspect that my assumption wasn’t quite correct. Having created a fam object via fam = Family.create(:file_id => 1), I decided to see what methods it had. fam.methods gave me a long list, and voila, among them I noticed one called save. Sure enough, fam.save did the trick. :)
[tags]Ruby on Rails[/tags]
Throw in your two cents