Add support for Rails 4.1

This PR adds support for Rail 4.1, it was based on @jtomaszewski work.
Also with this version support for custom headers were added, it was based on @diddeb work