Skip to content

Subclassed models generate scope override warnings #48

pdobb opened this Issue Mar 3, 2011 · 7 comments

8 participants

pdobb commented Mar 3, 2011

In Rails 3.0.5, any subclassed model that is loaded, ever, will produce the following warning in the Rails server log:

Creating scope :page. Overwriting existing method <model_name>.page.

I believe a proper fix here would be to have Kaminari make sure that it has not created the page (and others?) scope before doing so. This way, when a subclass initializes it would not recreate/override the scope that was already defined on the parent class. It's not necessary and it produces this warning message (see:

If you'd like to see a sample app where this happens I can upload one to github.


echon commented Apr 1, 2011

I get the same thing, Rails 3.0.5 and Ruby 1.8.7

Creating scope :page. Overwriting existing method
Creating scope :page. Overwriting existing method
Creating scope :page. Overwriting existing method
Creating scope :page. Overwriting existing method

All of those are sub-classes to Asset. None of which define paginates_per in their models (actually none of my models do).

@amatsuda amatsuda was assigned Apr 21, 2011

Thanks for reporting! (and sorry for not responding this long).
Confirmed this issue, but I still wonder whether Kaminari should just check the existing scopes and skip overwriting, or should do overwrite.
Let me think a little bit more...


Any update on this? It's still an issue. Seems it should realize if it's a subclass...

diddeb commented Dec 10, 2011

Any planned progress on this? Still seeing the exact same problem as pdobb initially described. I am on Rails 3.1.1.

dsgh commented Dec 28, 2011

I had the same problem, but it seems to be fixed as of 0.13.0.


Yes the 0.13 solved this. This one should be definitely closed.

yuki24 commented Jul 3, 2012

I'm closing this issue since this is a duplicate of #57.

@yuki24 yuki24 closed this Jul 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.