with_scope is protected

I’ve seen a lot of people run into trouble using with_scope on edge. It’s now a protected method Ticket: http://dev.rubyonrails.org/ticket/8524.

The solution? Don’t use it or use it sparingly. They made it protected for a reason – to protect people from abusing it – but if you absolutely must have at it then you can do something like this:

So say you want to scope your finders to retrieve only MyModel objects of type ‘super’:

Using self.class.send is a way to get around public and private checking in ruby 1.8. Use with caution.