geddy / model

Datastore-agnostic ORM in JavaScript
265 stars 55 forks source link

Eager loading not working with #first #75

Closed morokhovets closed 11 years ago

morokhovets commented 11 years ago

When trying something like

geddy.model.Model.first params.id, {includes: ['assoc']}, (err, model) =>
  model.assocs.length #=> ALWAYS 1 (or 0 if empty)

you'll always will get association array with only 1 element. Model.first always adds "LIMIT 1" to query contradicting with eager-loading logic.

mde commented 11 years ago

Fixed in 31feb96b578682a60f135d03ec4ab507d4cc8aff, pushed to NPM in v0.2.2.