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 547253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:57:14+00:00 2026-05-13T10:57:14+00:00

EDIT Looks like I figured it out – I had to call paginate after

  • 0

EDIT Looks like I figured it out – I had to call paginate after the call to all from Searchlogic.

I’m trying to use both of these tools to enable users to search contacts and return a paginated list (or the entire paginated list if they don’t enter any search criteria). However I’m unsure of the proper way to chain them together, and what I’m trying is giving me errors.

Here is my controller:

class ContactsController < ApplicationController
  def index
    @search = Contact.search(params[:search]).paginate(:page => params[:page])
    @contacts, @contacts_count = @search.all, @search.count
  end
end

This gives me the error Undefined method 'all' for WillPaginate. Removing the all gives me an error because the view is looking for a path that has the word “contact” 20 times (e.g. contact_contact_contact..._path), presumably because the default “per page” is 20.

What am I doing wrong? I would like to have searching, ordering and pagination all on this page.

  • 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-13T10:57:14+00:00Added an answer on May 13, 2026 at 10:57 am

    I was getting confused by this as well. You want to do the following:

    class ContactsController < ApplicationController
      def index
        @search = Contact.search(params[:search])
        @contacts = @search.paginate(:page => params[:page])
      end
    end
    

    In your view just call @contacts.total_entries to get the total count (will_paginate automatically adds that in).

    As soon as you call .paginate it triggers the query. So when you even though you think you are setting @search to a Searchlogic object, you aren’t. You are setting it to a WillPaginate array which has no method .all that you can call.

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

Sidebar

Related Questions

So here is what the method looks like now: POST person/personId/edit https://api.example.com/*key*/person/*personId*/edit?FName=Blah I want
Here's what the post submit URL looks like: default.cfm?fuseaction=Seasons.edit&sid=2569#errors I've added an internal anchor
I trying to convert a NSString that looks like this: @00:00 15 September 2012
I'm trying to use printf to print out an array of chars inside a
[Edit]: I figured out how to do this on my own. I posted my
I thought I had it figured out but now I'm missing something. First I
I have a line of php code that looks like this: echo <script>$('#edit_errors').html('<h3><em>Please Correct
Currently whenever the timestamp is echo'ed it looks like this function show_posts($userid){ $posts =
Take a look at my code example at js bin: http://jsbin.com/iritep/3/edit I'd like to
EDIT - The code looks strange here, so I suggest viewing the files directly

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.