0

In my model i've defined relationship, so it's property with foreign key is substituded by related model.

I had an idea to give away from database two same values, for example relatedId and related - if i define models relationships for field related, relatedId value will be left untouched - and i will be able to use it.

Is it possible somehow to use collection.where() method in backbone relational on model attributes, that represent related models (they have object data type)? if i define related id - like following - it does not work:

collection.where({
    related : 14 // this property contains related model, but not id after backbone initializes, i've also tried to use relatedId key instead - this does not work
})

I need such method very much, because i have to find models by lot of attributes, and it is very hard to do it from scratch :/

Could you please advice a way?

avasin
  • 9,186
  • 18
  • 80
  • 127

1 Answers1

0

I really like using database "views" to effectively flatten relationships for way easier querying. It works well.

Locohost
  • 1,682
  • 5
  • 25
  • 38