Fix indentation of case ... when statements
Get rid of unnecessary line wraps

These line wraps are no longer needed after the indentation is fixed.
Reused existing local variable
Refactor a handful more models

Group attribute constraints by attribute, and update some database
queries for Rails 4.