Client-side, always show properties by their presentation, not their name

This commit is contained in:
Rohan Mitchell
2016-08-31 10:11:05 +10:00
parent 8339d247f8
commit e00846776e
2 changed files with 7 additions and 1 deletions

View File

@@ -45,7 +45,7 @@ module InjectionHelper
end
def inject_properties
inject_json_ams "properties", Spree::Property.all, Api::IdNameSerializer
inject_json_ams "properties", Spree::Property.all, Api::PropertySerializer
end
def inject_currency_config

View File

@@ -1,3 +1,9 @@
class Api::PropertySerializer < ActiveModel::Serializer
attributes :id, :name, :presentation
# Client-side we don't care about the property name. Send the presentation
# since this is what we want to show to the user.
def name
object.presentation
end
end