Skip to content

Allow includes to follow namespacing#904

Merged
lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom
nagirrab:fix/nested_resource_includes
Nov 16, 2016
Merged

Allow includes to follow namespacing#904
lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom
nagirrab:fix/nested_resource_includes

Conversation

@nagirrab
Copy link
Copy Markdown
Contributor

Minor bug fix: there was a bug where if you do an include across a namespace boundary, e.g. in the case of:

class BaseResource
  relationship :intermediate, to: :one, class_name: "Namespaced::Intermediate",
end

class Namespaced::IntermediateResource
   relationship :child, to: :one
end

class Namspaced::ChildResource
  relationship :intermediate, to: :one
end

An includes request of ?includes=intermediate.child would bomb out because it was using BaseResource rather than Namespaced::IntermediateResource for looking up ChildResource. This fixes that specific issue.

Not sure what your intentions with regards to namespaced resources are in general - I've had to put a few hacks in place to make things work in general, but this particular bug fix seems like it should go in right away.

@lgebhardt lgebhardt merged commit acac529 into JSONAPI-Resources:master Nov 16, 2016
@lgebhardt
Copy link
Copy Markdown
Contributor

@nagirrab Thanks!

The original intent was to have namespaces used for versioning, so it's not a surprise that you've had some issues mixing resources across namespaces. In the cases fully supported by JR the namespace of the @resource_klass and resource_klass should be the same. It's not going to be simple to get mixed namespaces fully supported, but it seems there is demand for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants