I know named scopes are getting all changed around in Rails 3, but I figured this out a while ago, and then forgot it, came here to find my answer, and realized I never wrote it down.
The problem is that when you're building complex chained scopes its often useful to examine the state of the query, particularly if you're doing a lot of joins and you don't want to join on the same table twice.
proxy_options
- kueda on May 10, 2010, 09:22 PM UTC
>> scope = YourModel.scoped({})
>> scope = scope.some_scope(some_arg)
>> scope.proxy_options[:joins]
=> "INNER JOIN piffles on piffles.your_model_id = your_models.id"