Begin back porting various Rails 4 model changes

A large number of changes to model queries can be back ported to run on Rails 3. Since it is easier to do things in smaller pieces, I plan to open a series of pull requests that try and do much of the upgrade work without actually upgrading to Rails 4.

This set of updates only covers some of the models, there are many more changes to queries that could run on Rails 3. I can open new PRs for them or just append to this one, depending on what is preferred.