Port gem to Rails >= 4