We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Problem: You want to expose relationships that are not normal ActiveRecord associations, such as those created by Ancestry.
Solution: Use the eager_load_on_include: false flag, along with the class_name argument to explain what the real model table is.
eager_load_on_include: false
class_name
class Tree has_ancestry end class TreeResource < JSONAPI::Resource relationship :subtree, to: :many, eager_load_on_include: false, class_name: "Tree" relationship :children, to: :many, eager_load_on_include: false, class_name: "Tree" relationship :parent, to: :one, always_include_linkage_data: true, eager_load_on_include: false, class_name: "Tree" end
Thanks to Hugh Barrigan for this tip.
Home