Update nested attributes to be compatible with AR 4.0.0

This updates nested attributes to reflect changes in ActiveRecord 4.0.0 and should fix #167.

Tests pass on sqlite3, mysql, and postgresql.