Refactor a handful more models

Group attribute constraints by attribute, and update some database
queries for Rails 4.
Extra empty line detected at body beginning.