From 5c0cdce597424b9435ff7735f92c502f20040570 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 15 Apr 2021 12:55:17 +1000 Subject: [PATCH] Confine Permalinks patch to application We were also patching ActiveRecord::Relation for the `#find_by_param` methods but we are not using those any more. They were deprecated a while ago. We now use `find_by(permalink: ...)`. --- app/models/application_record.rb | 1 + lib/spree/core/permalinks.rb | 11 ----------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index ca22338d5d..e4478b1559 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -2,6 +2,7 @@ class ApplicationRecord < ActiveRecord::Base include DelegateBelongsTo + include Spree::Core::Permalinks include Spree::Preferences::Preferable self.abstract_class = true diff --git a/lib/spree/core/permalinks.rb b/lib/spree/core/permalinks.rb index b9d8a83274..b667de7b2c 100644 --- a/lib/spree/core/permalinks.rb +++ b/lib/spree/core/permalinks.rb @@ -23,14 +23,6 @@ module Spree before_validation(on: :create) { save_permalink } end - def find_by_param(value, *args) - __send__("find_by_#{permalink_field}", value, *args) - end - - def find_by_param!(value, *args) - __send__("find_by_#{permalink_field}!", value, *args) - end - def permalink_field permalink_options[:field] end @@ -70,6 +62,3 @@ module Spree end end end - -ActiveRecord::Base.include(Spree::Core::Permalinks) -ActiveRecord::Relation.include(Spree::Core::Permalinks)