discourse-chat-integration/app/serializers/rule_serializer.rb

14 lines
383 B
Ruby
Raw Normal View History

class DiscourseChat::RuleSerializer < ApplicationSerializer
2017-07-28 15:27:49 -04:00
attributes :id, :channel_id, :group_id, :group_name, :category_id, :tags, :filter
def group_name
if object.group_id
groups = Group.where(id:object.group_id)
if groups.exists?
return groups.first.name
else
return I18n.t("chat_integration.deleted_group")
end
end
end
end