Make gem compatible with Rails 4