mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Removed unnecessary code copied and replaced with call to identical super class
This commit is contained in:
@@ -5,22 +5,10 @@ module Spree
|
||||
before_filter :load_hubs, only: [:new, :edit, :create, :update]
|
||||
|
||||
# Sort shipping methods by distributor name
|
||||
# ! Code copied from Spree::Admin::ResourceController with two added lines
|
||||
def collection
|
||||
return parent.send(controller_name) if parent_data.present?
|
||||
collection = super
|
||||
collection = collection.managed_by(spree_current_user).by_name
|
||||
|
||||
collection = if model_class.respond_to?(:accessible_by) &&
|
||||
!current_ability.has_block?(params[:action], model_class)
|
||||
|
||||
model_class.accessible_by(current_ability, action)
|
||||
|
||||
else
|
||||
model_class.scoped
|
||||
end
|
||||
|
||||
collection = collection.managed_by(spree_current_user).by_name # This line added
|
||||
|
||||
# This block added
|
||||
if params.key? :enterprise_id
|
||||
distributor = Enterprise.find params[:enterprise_id]
|
||||
collection = collection.for_distributor(distributor)
|
||||
|
||||
Reference in New Issue
Block a user