Refactor some more models

Grouping attribute constraints, and updating some queries for Rails 4.

Just the last batch...
Space inside { missing.<br>Space inside } missing.