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
Trying to update tapioca from 0.12.0 to 0.13.1 results in this error:
path/to/file.rb:32: Method page does not exist on Model::PrivateAssociationRelation https://srb.help/7003
32 | @records = Model.all.page(params[:page]).per(25)
Trying to update tapioca from 0.12.0 to 0.13.1 results in this error:
Investigation
The page method is defined on the class by kaminari:
https://github.com/kaminari/kaminari/blob/9182d065c144afa45c6b7cf444f810bea1fd7201/kaminari-activerecord/lib/kaminari/activerecord/active_record_model_extension.rb#L14-L23
But attempting to introspect it at runtime yields nothing:
This is because it is delegated by https://github.com/rails/rails/blob/d37c533139f70efdcd95f8dadd48c10eba429f94/activerecord/lib/active_record/relation/delegation.rb#L71-L88
Which is generated on demand when the method is missing:
https://github.com/rails/rails/blob/d37c533139f70efdcd95f8dadd48c10eba429f94/activerecord/lib/active_record/relation/delegation.rb#L115-L124
Attempting the same as above after calling the method once does yield something a bit more interesting:
The same can be achieved by calling
Model.generate_relation_method(:page)
Workaround
Adding this in
config/initializers/kaminari.rb
makes tapioca generate the methods:The text was updated successfully, but these errors were encountered: