mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Make spree_current_user available to serializers as 'scope'
This commit is contained in:
@@ -49,12 +49,12 @@ module Admin
|
||||
|
||||
|
||||
def admin_inject_json_ams(ngModule, name, data, serializer, opts = {})
|
||||
json = serializer.new(data).to_json
|
||||
json = serializer.new(data, scope: spree_current_user).to_json
|
||||
render partial: "admin/json/injection_ams", locals: {ngModule: ngModule, name: name, json: json}
|
||||
end
|
||||
|
||||
def admin_inject_json_ams_array(ngModule, name, data, serializer, opts = {})
|
||||
json = ActiveModel::ArraySerializer.new(data, {each_serializer: serializer}.merge(opts)).to_json
|
||||
json = ActiveModel::ArraySerializer.new(data, {each_serializer: serializer, scope: spree_current_user}.merge(opts)).to_json
|
||||
render partial: "admin/json/injection_ams", locals: {ngModule: ngModule, name: name, json: json}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user