local-ch / lhs

⚛️ REST services accelerator: Rails gem providing an easy, active-record-like interface for http (hypermedia) json services
GNU General Public License v3.0
137 stars 3 forks source link

Include nested data that's nested in structures #376

Closed 10xSebastian closed 4 years ago

10xSebastian commented 4 years ago

This enables us to load nested linked data, even if it has been nested in unlinked structures:

Upcoming place change:

{
  "customer": {
    "salesforce": {
      "href": "https://salesforce/customers/1"
    }
  }
}

customer itself is not a linked resource on it's own, it's just another structure/namespace.

Previously LHS tried to load that namespace when you would instruct it to load the salesforce customer

Place.includes(customer: :salesforce).find(1)
# raised an exception

Now LHS skips the namespace customer as it does not have an href and therefore does not need to be loaded.