-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
In my controller I have
module API
module V1
class ProjectsController < API::V1::ApplicationController
# GET /projects
def index
render jsonapi: Project.all,
class: { Project: API::V1::SerializableProject },
include: params[:include]
end
In my Serializer I have
module API
module V1
class SerializableProject < JSONAPI::Serializable::Resource
type 'projects'
attributes :name, :job_number
has_many :companies
end
end
end
When I pass the include
params with GET /projects?include=companies
, I get undefined method 'new' for nil:NilClass
. I'm assuming because it can't find API::V1::SerializableCompany
How am I supposed to specify the class for all includes? This was a simplified example, but some of my Models have multiple relationships.
Metadata
Metadata
Assignees
Labels
No labels