mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-06 07:29:16 +00:00
included LogDestroyPerformer on product model
This commit is contained in:
@@ -42,6 +42,7 @@ module Api
|
||||
authorize! :delete, Spree::Product
|
||||
@product = product_finder.find_product
|
||||
authorize! :delete, @product
|
||||
@product.destroyed_by = current_api_user
|
||||
@product.destroy
|
||||
render json: @product, serializer: Api::Admin::ProductSerializer, status: :no_content
|
||||
end
|
||||
|
||||
@@ -6,6 +6,7 @@ module LogDestroyPerformer
|
||||
extend ActiveSupport::Concern
|
||||
included do
|
||||
attr_accessor :destroyed_by
|
||||
|
||||
after_destroy :log_who_destroyed
|
||||
|
||||
def log_who_destroyed
|
||||
|
||||
@@ -23,6 +23,7 @@ require 'open_food_network/property_merge'
|
||||
module Spree
|
||||
class Product < ApplicationRecord
|
||||
include ProductStock
|
||||
include LogDestroyPerformer
|
||||
|
||||
self.belongs_to_required_by_default = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user