Fix deprecated use of scope by using lambda.

scope (and default_scope) without lambda have been deprecated in Rails 4.
This change fixes that and also removes support for Rails 2, because doing otherwise would require excessive compatibility code.