You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This type is accurate, since .page uses .extending to add methods to the relation.
This works:
User.page(5).total_count
This doesn't work:
User.page(5).all.total_count
^^^^^^^^^^^ Method`total_count`does not existon`User::PrivateRelation`
That's because the return type of for .all is PrivateRelation. We could fix this problem by using T.self_type instead, which I believe more accurately captures the way ActiveRecord works.
The way that relevant compilers are currently implemented makes this a little tricky, since the methods that are being added to the PrivateRelation are also added to the model. The methods defined on the model should be PrivateRelation.
The text was updated successfully, but these errors were encountered:
I wrote a compiler for Kaminari that returns the following:
This type is accurate, since
.page
uses.extending
to add methods to the relation.This works:
This doesn't work:
That's because the return type of for
.all
isPrivateRelation
. We could fix this problem by usingT.self_type
instead, which I believe more accurately captures the way ActiveRecord works.The way that relevant compilers are currently implemented makes this a little tricky, since the methods that are being added to the
PrivateRelation
are also added to the model. The methods defined on the model should bePrivateRelation
.The text was updated successfully, but these errors were encountered: