Make the gem Rails 4 compatible.

These changes allow the gem to be used in Rails 4 projects.