From fe7bd5e2cd35122245ba5ed93003a315e61c7ff2 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 27 Jul 2016 15:58:54 +1000 Subject: [PATCH] Serialise tag_list only for variant overrides Don't try to call tag_list on just variants since that will fail. Normally, all variants of `current_order` should be extended to VariantOverrides of the current order cycle. But in development environment, it can happen that the variants are reloaded without being extended again. --- app/serializers/api/variant_serializer.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/serializers/api/variant_serializer.rb b/app/serializers/api/variant_serializer.rb index 6a38fe9b93..c1fa8d213b 100644 --- a/app/serializers/api/variant_serializer.rb +++ b/app/serializers/api/variant_serializer.rb @@ -1,7 +1,6 @@ class Api::VariantSerializer < ActiveModel::Serializer attributes :id, :is_master, :count_on_hand, :name_to_display, :unit_to_display attributes :options_text, :on_demand, :price, :fees, :price_with_fees, :product_name - attributes :tag_list def price object.price @@ -23,4 +22,8 @@ class Api::VariantSerializer < ActiveModel::Serializer def product_name object.product.name end + + def tag_list + object.tag_list if object.is_a? VariantOverride + end end