In AR 4.0, you can have ActiveRecord automatically cast them to a different type.
Turns out support for that's in 4.0 too!
https://github.com/rails/rails/pull/4775
Take a look at @tenderlove's comment down below about the actual implementation (as opposed to my crappy one in the issue body).