[Rails] STI with_scope on parent - bug or feature?

Jeroen Houben jeroen at terena.nl
Sat Apr 1 07:37:42 GMT 2006


Hi,

It seems that setting a with_scope on the parent class doesn't do anything

MyClass.with_scope(:find=>{:conditions=> ["somecol = ?", 'val']}) do
   @ext_pages, @ext_rows = paginate :my_extended_class, {
     :per_page => 13
   }
end
# this doesn't generate WHERE somecol='val'

In order for scope to work you have to call with_scope on the 
specialized class you'll later call the find/paginate methods on, like this:

MyExtendedClass.with_scope()

Should I consider this a feature or a bug?

jeroen


More information about the Rails mailing list