Read more

Check if an object is an ActiveRecord scope

Henning Koch
August 01, 2012Software engineer at makandra GmbH

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).

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

A good way is to say this instead:

object.respond_to?(:scoped)
Posted by Henning Koch to makandra dev (2012-08-01 13:36)