mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 01:35:34 +08:00
7f7bf0533a
* Fix tests [SCI-6486] * Fix rspec tests [SCI-6486] Co-authored-by: Anton <anton@scinote.net>
25 lines
659 B
Ruby
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
|