Minimal upgrade for Rails 4.1 compatibility.

Mostly duplicate changes to #57, but without changes unrelated to Rails changes. Also, this has Rails 4.1 support by passing a block to `default_scope`.