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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:07:38+00:00 2026-06-01T22:07:38+00:00

So I have a search controller that returns a array of Object IDs (in

  • 0

So I have a search controller that returns a array of Object IDs (in this case ‘Users’).

Since the search results array can contain hundreds of IDs, I’d rather fetch the actual Objects themselves only when I need to send them to the view. In short, I want to use pagination to fetch the Objects themselves beforehand for each chunk of IDs (i.e. 1..10, 11..20, etc), rather than have the view logic fetch the Objects. I have no idea how to accomplish this.

My controller code

users = [1,3,456,23423,234,23...]
#somehow have the pagination get the Objects from DB for each page
@persons = Kaminari.paginate_array(users).page(params[:page]).per(10)

View

- @persons.each do |person| #I WANT TO HAVE THE FULL WRITER OBJECT BY NOW
  = person.name             # instead of doing a 'User.find(person.id)' in the view

Any ideas?

Thanks in advance!

  • 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-06-01T22:07:39+00:00Added an answer on June 1, 2026 at 10:07 pm

    put a page number parameter in the url. Then if you want to display 10 per page and say the user clicks page three, subtract page number by one page (10) and add one giving you 21. this is your start for the database query. and limit to 10 results

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

Sidebar

Related Questions

I currently have this as a search: <%= form_tag users_path, :controller => 'users', :action
I have some nifty javascript that serializes search input. the controller has this: @recipes
So I have a search form that returns a Kaminari paginated array. The first
I have a search display controller in a table view. In this table view,
I have a search form that can search in different provider. I started out
I have a form_tag that submits a user's search remotely to a Rails controller
I have a controller that returns a list of custom linq-to-sql model objects in
I have a search Api I'm working on that needs to return search results
I have the following controller: public ActionResult Search(string Name, int? Friend, int? Page) It
I have search in MSDN and I can't figure where are the POST parameters

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.