Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search not returns Instances. Returns Json Objects #385

Open
joseglego opened this issue Jun 27, 2016 · 1 comment
Open

Search not returns Instances. Returns Json Objects #385

joseglego opened this issue Jun 27, 2016 · 1 comment

Comments

@joseglego
Copy link

joseglego commented Jun 27, 2016

I was working with this lib. And following the example in the documentation. I'm doing:

Bike.$search({ brand: 'Trek' })

The return is ok, a list with all possible bikes with the brand. But, what happen now If I wanna modify each element of the list and update it?. The return is just a list of Json Objects. But I think it must return a List of instances of Bikes instances.

  • If I try with Bike.$build() it will do a new instance, and then Bike.$save().
  • But if I try with Bike.$find() for each instance of the list is not elegant and efficient.

I think the $save() can evaluate if the Instance have an Id and do an UPDATE or if have not id do a POST. Or the list must be a list of Bikes instances.

@jpulec
Copy link
Contributor

jpulec commented Sep 22, 2016

The result of Bike.$search({brand: 'Trek'}) should be a restmod Collection. A Collection contains individual instances of Bike. What does more of your code look like?

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

No branches or pull requests

2 participants