mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix with_products_on_hand query for server db compatibility
This commit is contained in:
@@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base
|
||||
private
|
||||
def load_data_for_sidebar
|
||||
@suppliers = Spree::Supplier.all
|
||||
@distributors = Spree::Distributor.with_products_on_hand
|
||||
@distributors = Spree::Distributor.with_products_on_hand.by_name
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ module Spree
|
||||
validates_associated :pickup_address
|
||||
|
||||
scope :by_name, order('name')
|
||||
scope :with_products_on_hand, joins(:products).where('spree_products.count_on_hand > 0').group('distributors.id')
|
||||
scope :with_products_on_hand, joins(:products).where('spree_products.count_on_hand > 0').select('distinct(distributors.*)')
|
||||
|
||||
after_initialize :initialize_country
|
||||
before_validation :set_unused_address_fields
|
||||
|
||||
Reference in New Issue
Block a user