module PaperTrail::Compatibility
Rails
does not follow SemVer, makes breaking changes in minor versions. Breaking changes are expected, and are generally good for the rails ecosystem. However, they often require dozens of hours to fix, even with the [help of experts](github.com/paper-trail-gem/paper_trail/pull/899).
It is not safe to assume that a new version of rails will be compatible with PaperTrail
. PT is only compatible with the versions of rails that it is tested against. See ‘.github/workflows/test.yml`.
However, as of [#1213](github.com/paper-trail-gem/paper_trail/pull/1213) our gemspec allows installation with newer, incompatible rails versions. We hope this will make it easier for contributors to work on compatibility with newer rails versions. Most PT users should avoid incompatible rails versions.
Constants
- ACTIVERECORD_GTE
- ACTIVERECORD_LT
- E_INCOMPATIBLE_AR
Public Class Methods
Normal users need a warning if they accidentally install an incompatible version of ActiveRecord. Contributors can silence this warning with an environment variable.
# File lib/paper_trail/compatibility.rb, line 35 def self.check_activerecord(ar_version) raise ::TypeError unless ar_version.instance_of?(::Gem::Version) return if ::ENV["PT_SILENCE_AR_COMPAT_WARNING"].present? req = ::Gem::Requirement.new([ACTIVERECORD_GTE, ACTIVERECORD_LT]) unless req.satisfied_by?(ar_version) ::Kernel.warn( format( E_INCOMPATIBLE_AR, ::PaperTrail.gem_version, ar_version, req ) ) end end