make rails 4.2 compatibility changes conditional on rails version to stay backwards compatible