group_relationship_serializer.rb 349 Bytes
Newer Older
Rob Colbert's avatar
Rob Colbert committed
1 2 3
# frozen_string_literal: true

class REST::GroupRelationshipSerializer < ActiveModel::Serializer
mgabdev's avatar
pull  
mgabdev committed
4
  attributes :id, :member, :admin
Rob Colbert's avatar
Rob Colbert committed
5 6 7 8 9 10 11 12 13 14 15 16

  def id
    object.id.to_s
  end

  def member
    instance_options[:relationships].member[object.id] ? true : false
  end

  def admin
    instance_options[:relationships].admin[object.id] ? true : false
  end
2458773093's avatar
2458773093 committed
17

Rob Colbert's avatar
Rob Colbert committed
18
end