mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
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:
@@ -2,6 +2,7 @@
|
||||
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
include DelegateBelongsTo
|
||||
include Spree::Core::Permalinks
|
||||
include Spree::Preferences::Preferable
|
||||
|
||||
self.abstract_class = true
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user