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: ...)`.
This commit is contained in:
Maikel Linke
2021-04-15 12:55:17 +10:00
parent 125374c488
commit 5c0cdce597
2 changed files with 1 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
class ApplicationRecord < ActiveRecord::Base
include DelegateBelongsTo
include Spree::Core::Permalinks
include Spree::Preferences::Preferable
self.abstract_class = true

View File

@@ -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)