Skip to content

Instantly share code, notes, and snippets.

@edubkendo
Created August 8, 2012 06:10
Show Gist options
  • Select an option

  • Save edubkendo/3292698 to your computer and use it in GitHub Desktop.

Select an option

Save edubkendo/3292698 to your computer and use it in GitHub Desktop.
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.

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