Refactor a handful more models

Group attribute constraints by attribute, and update some database
queries for Rails 4.
Align the elements of a hash literal if they span more than one line.