lockitron/selfstarter — pull request #31 by sohaibbhatti (2013-02-09 17:43:39+00:00)
Title: Fix order scope bug

This Pull Request serves two purposes

### Adding [Annotate Models](https://github.com/ctran/annotate_models)

In the code base, all models and specs have their attributes and corresponding datatypes in the form of comments. This makes development for developers easier by serving as a visual cue.

### Fixed a Bug in the order completed scope

Prior to this, the Order.completed scope was returning the following SQL.

```sql
SELECT "orders".* FROM "orders" WHERE (token != '' OR token != NULL)
```
The SQL is incorrect because logical operations on NULL will always result in a NULL. i.e. (NULL = NULL would yield a NULL). It has now been fixed to

```sql
SELECT "orders".* FROM "orders" WHERE (token != '' OR token IS NOT NULL)
```