mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
- new controller serving tags for an enterprise as JSON - customers page suggesting these tags - emphasising tags that have rules
16 lines
352 B
Ruby
16 lines
352 B
Ruby
class Api::Admin::CustomerSerializer < ActiveModel::Serializer
|
|
attributes :id, :email, :enterprise_id, :user_id, :code, :tags, :tag_list
|
|
|
|
def tag_list
|
|
object.tag_list.join(",")
|
|
end
|
|
|
|
def tags
|
|
tag_rule_map = object.enterprise.rules_per_tag
|
|
object.tag_list.map do |tag|
|
|
{ text: tag, rules: tag_rule_map[tag] }
|
|
end
|
|
end
|
|
|
|
end
|