rails 4.1 support

another pr do it in different way, I think it's better way