edubkendo
8/8/2012 - 6:10 AM

Couple notes on Tower scopes and documentation.

Couple notes on Tower scopes and documentation.

When using scopes, it is important to do/chain things in the proper order. For instance:

user = App.User.where({firstName: 'bob'}).find().objectAt(0).toJSON()

Will give the expected results, but, changing the order of 'find' and 'where' returns all the objects.

Also, some of the examples use scopes like:

users = App.User.where(createdAt: ">=": _(0).days().ago(), "<=": new Date())

and these still fail. We'll need to find and label these in the documentation so people don't experience frustration when their carefully copied code doesn't work.