Add backwards-compatible support for rails 4