From 4a4b3da551a795f8bb0e3f0d7e2c7d13a4b35e4f Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Wed, 22 Apr 2015 16:15:59 +1000 Subject: [PATCH] Using properties_including_inherited for product properties on the shop page --- app/serializers/api/product_serializer.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/serializers/api/product_serializer.rb b/app/serializers/api/product_serializer.rb index 78f7593e4f..7359c25b1c 100644 --- a/app/serializers/api/product_serializer.rb +++ b/app/serializers/api/product_serializer.rb @@ -31,17 +31,20 @@ class Api::CachedProductSerializer < ActiveModel::Serializer #delegate :cache_key, to: :object attributes :id, :name, :permalink, :count_on_hand, :on_demand, :group_buy, - :notes, :description + :notes, :description, :properties has_many :variants, serializer: Api::VariantSerializer has_many :taxons, serializer: Api::IdSerializer - has_many :properties, serializer: Api::IdSerializer has_many :images, serializer: Api::ImageSerializer has_one :supplier, serializer: Api::IdSerializer has_one :primary_taxon, serializer: Api::TaxonSerializer has_one :master, serializer: Api::VariantSerializer + def properties + object.properties_including_inherited + end + def variants # We use the in_stock? method here instead of the in_stock scope because we need to # look up the stock as overridden by VariantOverrides, and the scope method is not affected