sdford/projectChuck — pull request #15 by profh (2014-03-23 00:43:05+00:00)
Title: Populate: adds 100 households w/ associated students and guardians

The pull request is designed to add 100 households to the dev db and along with those households, it will add 1-4 students and 1-2 guardians in that household. A number of other changes were made:

1. A series of testing and development gems were added
2. The validate_timeliness install generator was run
3. Relationships in Student and Guardian were added to directly connect entities (and remove a problematic scope in Guardian called 'children')
4. The gender methods in Student and Guardian were changed to 'sex' to avoid a 'stack too deep' error (since gender is also a setter method due to the fact there is a gender field in the database)
5. The date validation in student was changed to not use the :between method. (Comment in code says documentation not clear about the method , so I read through the source code itself and could find no reference to the method. Also couldn't find any tests for it. Might be overlooking something, but didn't want to waste more time reading code, so I just rewrote it so I could add students.)

I strongly encourage you to write some unit tests on your code as I can see a few more issues that will come up down the road. I think it's best to discover them now with unit tests and avoid a nasty surprise last in the game.

To add the data, run the migrations first and then run 'rake db:populate'. It will print out some feedback so you can see what is being added. You might want to tweak the script (especially probabilities -- right now nearly half of families will have 2 guardians of the same gender which is not realistic) after you complete unit testing.