discourse/app/serializers/invite_serializer.rb

20 lines
357 B
Ruby
Raw Normal View History

2013-02-05 13:16:51 -06:00
class InviteSerializer < ApplicationSerializer
attributes :email, :created_at, :redeemed_at, :expired, :user
2013-02-05 13:16:51 -06:00
def include_email?
!object.redeemed?
end
def expired
object.expired?
end
def user
ser = InvitedUserSerializer.new(object.user, scope: scope, root: false)
ser.invited_by = object.invited_by
ser.as_json
end
2013-02-05 13:16:51 -06:00
end