Gab Social. All are welcome.
This commit is contained in:
17
app/serializers/rest/group_relationship_serializer.rb
Normal file
17
app/serializers/rest/group_relationship_serializer.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::GroupRelationshipSerializer < ActiveModel::Serializer
|
||||
attributes :id, :member, :admin
|
||||
|
||||
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
|
||||
end
|
||||
Reference in New Issue
Block a user