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 assignment model constraints and queries

Constraints are easier to make sense of when grouped by the
attribute that they are constraining.

Many of the query styles that will be deprecated in Rails 4 have
been updated. Though, some cannot be upgraded now as the API does
not yet exist.