mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Find variant overrides for some hubs
This commit is contained in:
@@ -2,6 +2,10 @@ class VariantOverride < ActiveRecord::Base
|
||||
belongs_to :variant, class_name: 'Spree::Variant'
|
||||
belongs_to :hub, class_name: 'Enterprise'
|
||||
|
||||
scope :for_hubs, lambda { |hubs|
|
||||
where(hub_id: hubs)
|
||||
}
|
||||
|
||||
def self.price_for(variant, hub)
|
||||
VariantOverride.where(variant_id: variant, hub_id: hub).first.andand.price
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user