Robdel12/blog — pull request #2 by tracehelms (2014-08-22 21:45:25+00:00)
Title: Add Rails functionality for "draft" posts

I used the `is_published` you already had and just created a default scope. If you don't want a default scope and want to explicitly call for published posts, you can do something like this:
```ruby
scope :published, -> { where(is_published: true) }
# then to get those records
Posts.published
```

The default scope, however, makes it a bit easier so you don't have to always remember to specify the published posts.

Also, added ability to view draft posts by adding a `draft = true` param, e.g.: `http://localhost:3000/api/posts?draft=true`