mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
17 lines
415 B
Ruby
17 lines
415 B
Ruby
class VariantOverrideSet < ModelSet
|
|
def initialize(collection, attributes={})
|
|
super(VariantOverride, collection, attributes, nil, proc { |attrs| deletable?(attrs) } )
|
|
end
|
|
|
|
private
|
|
|
|
def deletable?(attrs)
|
|
attrs['price'].blank? &&
|
|
attrs['count_on_hand'].blank? &&
|
|
attrs['default_stock'].blank? &&
|
|
attrs['resettable'].blank? &&
|
|
attrs['sku'].nil? &&
|
|
attrs['on_demand'].nil?
|
|
end
|
|
end
|