Using clearer json_request? method for customers controller

This commit is contained in:
Rob Harrington
2015-06-04 12:04:47 +08:00
parent c311bcdca7
commit ed7a53968c
2 changed files with 5 additions and 1 deletions

View File

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

View File

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