Hacky Rails 4 support, while maintaining support for Rails 3 and below.