scinote-web/app/serializers/api/v1/user_assignment_serializer.rb
aignatov-bio 7f7bf0533a
Fix tests [SCI-6486] (#3913)
* Fix tests [SCI-6486]

* Fix rspec tests [SCI-6486]

Co-authored-by: Anton <anton@scinote.net>
2022-03-09 14:12:16 +01:00

25 lines
659 B
Ruby

# frozen_string_literal: true
module Api
module V1
class UserAssignmentSerializer < ActiveModel::Serializer
type :user_assignments
attributes :id
belongs_to :user_role, serializer: UserRoleSerializer
belongs_to :user, serializer: UserSerializer
belongs_to :assignable
class << self
def serializer_for(model, options)
return TaskSerializer if model.instance_of? MyModule
return ExperimentSerializer if model.instance_of? Experiment
return ProjectSerializer if model.instance_of? Project
super
end
end
include TimestampableModel
end
end
end