Check if an object is an ActiveRecord scope

Don't say is_a?(ActiveRecord::NamedScope::Scope) because that is no longer true in Rails 3 and also doesn't match unscoped ActiveRecord classes themselves (which we consider scopes for all practical purposes).

A good way is to say this instead:

object.respond_to?(:scoped)
Henning Koch