-
Notifications
You must be signed in to change notification settings - Fork 539
Open
Description
We have models Contractor
and Mm::Kudo
and corresponding resources.
class ContractorResource < JSONAPI::Resource
model_name 'Coworker'
attributes :name, :uid, :avatar_url
has_many :kudos_given, class_name: 'Mm::Kudo'
end
class Mm::KudoResource < JSONAPI::Resource
model_name 'Mm::Kudo'
attributes :value, :tags, :comment
has_one :giver, class_name: 'Contractor'
end
And generate route for kudos-received
relation points to kudos#get_related_resources
controller instead of mm/kudos#get_related_resources
(btw.: includes work fine)
There two options:
- leave the default behaviour as it is and allow to overwrite controller at relationship level
e.g.: for the given example
has_many :kudos_given, class_name: 'Mm::Kudo', controller: 'mm/kudos'
and pass the relationship params to the jsonapi_related_resources
- use
model_name
to generate path for default controller (and still allow to overwrite controller at thehas_many
definition
Which option should we pick and adopt
Metadata
Metadata
Assignees
Labels
No labels