Skip to content
This repository was archived by the owner on Feb 25, 2022. It is now read-only.

Recommended way of accessing single remote records? #11

@coneybeare

Description

@coneybeare

I have a class Foo which has_many_remote Bars.

class Foo
  has_many_remote :bars, :path => "/foos/:id/bars"
end

This works great for collections, i.e., I can call @foo.bars and remotely will connect to the external api and populate an array of bars.

What is the recommended way to fetch a specific Bar, that also has the Foo's scope? In other words, I wish to call:

  /foos/1/bars/2

Currently, doing something like @foo.bars.find(2) produces the correct end-result, but fetches the collection then does the find in ruby. This could take forever if there are hundreds of bars associated with this foo. How can I make this call to get the specified bar resource only?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions