class JsonapiCompliable::Util::Sideload
@api private
Public Class Methods
namespace(a, b)
click to toggle source
Determine the namespace for the sideload
In other words, given a query like /things?include=a.b
When 'a' is sideloading 'b', b's namespace is 'b'.
However, consider a recursive tree structure:
/things?include=children.children
The first occurrance of “children” will have the namespace “children”, the second will be “children.children” and so forth.
This is used to match up other criteria in the query:
?filter[a]=b
@api private
# File lib/jsonapi_compliable/util/sideload.rb, line 24 def self.namespace(a, b) if a.to_s.split('.')[0] == b.to_s :"#{a}.#{b}" else b end end