Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6752819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:05:21+00:00 2026-05-26T13:05:21+00:00

Why does Post.page(1).total_pages result in: Post.page(1).total_pages undefined local variable or method `total_pages’ for #<ActiveRecord::Relation:0x00000006a95230>

  • 0

Why does Post.page(1).total_pages result in:

Post.page(1).total_pages
undefined local variable or method `total_pages' for #<ActiveRecord::Relation:0x00000006a95230>

but

Post.scoped.page(1).total_pages

works fine. Curiously,

Post.paginate(:page => 1).total_pages

works fine. I looked at the code on Github ( https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/active_record.rb ) and I can see why paginate works (because it calls limit first… which returns an active record relation, much like scoped does). I have a feeling it has something to do with this code

rel = scoped.extending(RelationMethods)

I guess I don’t understand the difference between these the active record relation that limit returns versus scoped.extending(RelationMethods). Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:05:21+00:00Added an answer on May 26, 2026 at 1:05 pm

    This only happens when using the rails_admin gem. It works fine in a fresh Rails 3.1.1 app with will_paginate 3.0.2.

    Rails admin is probably doing something to the page method, though I’m not sure what exactly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a continuation of the post How does one access a method from
I cant post the code (proprietary issues) but does anyone know what types of
Does anybody knows about post-processing algorithms to remove ghost objects from binarized image? The
Does anyone know how to initiate a POST request in a Grails applications using
Does anyone know how to insert a new post into Wordpress using sql?
does curl function need any special option to post multipart/form-data ?
Does anyone have some sample code showing how to POST to a URL using
First post, so here goes. I'm writing a script that does intelligent search and
does Flash comply with HTTP Location headers? For example, if Flash makes a POST
Does anyone know how to display 3 previous posts on article page? Let's say

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.