Module: ActiveRecord::Tenanted::Patches::Attributes

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_record/tenanted/patches.rb

Class Method Summary collapse

Class Method Details

.apply_patchObject



53
54
55
# File 'lib/active_record/tenanted/patches.rb', line 53

def apply_patch
  ActiveRecord::Base.prepend(self) if needs_patch?
end

.needs_patch?Boolean

This monkey patch isn’t necessary after 8.1 removed the need for a connection. For details see github.com/rails/rails/pull/54348

Returns:

  • (Boolean)


49
50
51
# File 'lib/active_record/tenanted/patches.rb', line 49

def needs_patch?
  Gem::Requirement.new("~> 8.1.0").satisfied_by?(Gem::Version.new(Rails::VERSION::STRING))
end