mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Using clearer json_request? method for customers controller
This commit is contained in:
@@ -17,7 +17,7 @@ module Admin
|
||||
private
|
||||
|
||||
def collection
|
||||
return Customer.where("1=0") if html_request? || params[:enterprise_id].nil?
|
||||
return Customer.where("1=0") unless json_request? && params[:enterprise_id].present?
|
||||
enterprise = Enterprise.managed_by(spree_current_user).find_by_id(params[:enterprise_id])
|
||||
Customer.of(enterprise)
|
||||
end
|
||||
|
||||
@@ -62,4 +62,8 @@ Spree::Admin::BaseController.class_eval do
|
||||
def html_request?
|
||||
request.format.html?
|
||||
end
|
||||
|
||||
def json_request?
|
||||
request.format.json?
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user