{"record":{"id":"93b00addb4b4be17","repo":"paper-trail-gem/paper_trail","slug":"papertrail-s-is-not-compatible-with-activerecord","errorCode":null,"errorMessage":"PaperTrail %s is not compatible with ActiveRecord %s. We allow PT\ncontributors to install incompatible versions of ActiveRecord, and this\nwarning can be silenced with an environment variable, but this is a bad\nidea for normal use. Please install a compatible version of ActiveRecord\ninstead (%s). Please see the discussion in paper_trail/compatibility.rb\nfor details.","messagePattern":"PaperTrail (.+?) is not compatible with ActiveRecord (.+?)\\. We allow PT\ncontributors to install incompatible versions of ActiveRecord, and this\nwarning can be silenced with an environment variable, but this is a bad\nidea for normal use\\. Please install a compatible version of ActiveRecord\ninstead \\((.+?)\\)\\. Please see the discussion in paper_trail/compatibility\\.rb\nfor details\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/paper_trail/compatibility.rb","lineNumber":40,"sourceCode":"\n    E_INCOMPATIBLE_AR = <<-EOS\n      PaperTrail %s is not compatible with ActiveRecord %s. We allow PT\n      contributors to install incompatible versions of ActiveRecord, and this\n      warning can be silenced with an environment variable, but this is a bad\n      idea for normal use. Please install a compatible version of ActiveRecord\n      instead (%s). Please see the discussion in paper_trail/compatibility.rb\n      for details.\n    EOS\n\n    # Normal users need a warning if they accidentally install an incompatible\n    # version of ActiveRecord. Contributors can silence this warning with an\n    # environment variable.\n    def self.check_activerecord(ar_version)\n      raise ::TypeError unless ar_version.instance_of?(::Gem::Version)\n      return if ::ENV[\"PT_SILENCE_AR_COMPAT_WARNING\"].present?\n      req = ::Gem::Requirement.new([ACTIVERECORD_GTE, ACTIVERECORD_LT])\n      unless req.satisfied_by?(ar_version)\n        ::Kernel.warn(\n          format(\n            E_INCOMPATIBLE_AR,\n            ::PaperTrail.gem_version,\n            ar_version,\n            req\n          )\n        )\n      end\n    end\n  end\nend\n","sourceCodeStart":22,"sourceCodeEnd":52,"githubUrl":"https://github.com/paper-trail-gem/paper_trail/blob/098058ae472d13763fe66e6866a6a4dfc64a3eca/lib/paper_trail/compatibility.rb#L22-L52","documentation":"PaperTrail deliberately only supports a bounded range of ActiveRecord versions (ACTIVERECORD_GTE '>= 7.1', ACTIVERECORD_LT '< 8.2', set in lib/paper_trail/compatibility.rb:20-21). Since #1213 the gemspec still lets you INSTALL newer/older ActiveRecord so PT contributors can work on compatibility, but at boot check_activerecord compares the loaded AR version against a Gem::Requirement and prints this Kernel.warn when it falls outside the range. It is a warning, not an exception: PT may work, but it is untested and likely to break subtly. The env var PT_SILENCE_AR_COMPAT_WARNING only exists for PT contributors, not production use.","triggerScenarios":"Booting any Rails app (or running `PaperTrail::Compatibility.check_activerecord(Gem.loaded_specs[\"activerecord\"].version)`) with activerecord >= 8.2 or < 7.1 installed next to this paper_trail release. Typically happens right after `bundle update rails` or adding `gem \"rails\", \"~> 8.2\"` while paper_trail is still pinned to a release whose gemspec range stops at 8.1.","commonSituations":"Upgrading Rails to a brand-new minor before a compatible paper_trail release ships; a loose Gemfile (`gem \"activerecord\"` with no constraint) letting bundler resolve an AR newer than PT supports; CI suddenly showing the warning after a lockfile refresh even though the app code did not change.","solutions":["Align ActiveRecord with the supported range stated in the message: in the Gemfile constrain rails/activerecord to a version satisfying >= 7.1 and < 8.2, then run `bundle install`.","Or upgrade paper_trail to the newest release that declares support for your ActiveRecord version (check the paper_trail changelog and .github/workflows/test.yml for the tested AR matrix).","Contributors only: export PT_SILENCE_AR_COMPAT_WARNING=1 to silence it while working on PT compatibility for the new AR — never set this in production, it hides a real untested-version risk."],"exampleFix":"# Gemfile - before\ngem \"rails\", \"~> 8.2\"\ngem \"paper_trail\"\n\n# Gemfile - after (satisfies >= 7.1, < 8.2)\ngem \"rails\", \"~> 8.1\"\ngem \"paper_trail\"\n# then: bundle update rails activerecord","handlingStrategy":"validation","validationCode":"# Check before relying on PaperTrail, e.g. in config/initializers/paper_trail_compat.rb\nreq = Gem::Requirement.new([\n  PaperTrail::Compatibility::ACTIVERECORD_GTE,\n  PaperTrail::Compatibility::ACTIVERECORD_LT\n])\nar_version = Gem.loaded_specs.fetch(\"activerecord\").version\nfail \"ActiveRecord #{ar_version} outside PaperTrail-supported range #{req}\" unless req.satisfied_by?(ar_version)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin rails/activerecord in the Gemfile with a pessimistic constraint (~> x.y) instead of letting bundler float to the newest release.","Before every Rails upgrade, check the paper_trail release notes / .github/workflows/test.yml for the tested ActiveRecord matrix and bump both gems in the same PR.","Treat this warning as a build failure in CI (grep boot output for 'not compatible with ActiveRecord') rather than ignoring stderr.","Never set PT_SILENCE_AR_COMPAT_WARNING in production; reserve it for paper_trail contributor environments."],"tags":["ruby","rails","activerecord","paper-trail","bundler","version-compatibility"],"backgroundTag":"gem-version-incompatibility","analyzedSha":"098058ae472d13763fe66e6866a6a4dfc64a3eca","analyzedAt":"2026-08-21T18:44:58.137Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}