Making gem compatible with Rails 4.1+