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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:24:11+00:00 2026-06-16T03:24:11+00:00

In my controller for the index action, I have; def index @documents = current_user.documents.all

  • 0

In my controller for the index action, I have;

def index
  @documents = current_user.documents.all if current_user
end

Anything I add on the end of current_user I get an error. For example, I tried to add will_paginate which is simply adding .paginate(:per_page => 5, :page => params[:page]) to the end of the index action and adding <%= will_paginate @documents %> to the views.

Once I add the .paginate(:per_page => 5, :page => params[:page]) to the end of the index method, like this;

def index
  @documents = current_user.documents.all if current_user.paginate(:per_page => 5, :page => params[:page])
end

I get a NoMethodError. Anybody know how to fix this?

  • 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-16T03:24:12+00:00Added an answer on June 16, 2026 at 3:24 am

    Try

    def index
      @documents = current_user.documents.paginate(:per_page => 5, :page => params[:page]) if current_user
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following in my controller: def index @games = Game.gamsearch(params[:gamsearch]) end def
I have a controller that has the following index action : def index if
In my index action of the controller I have got this: def index @vehicles
I'd like to have an Index action for a Users controller that takes an
I have a controller named Content, which has an Index action, which is associated
I need to test a controller, of action index (generated by the grails generate-all
My Index Controller: class IndexController < ApplicationController def index @posts = Post.find(:all, :limit =>
I have this action for in my posts_controller.rb : def index @search = Post.solr_search
map.root :controller => main, :action => index is not redirecting the main controller to
Consider this MapRoute: MapRoute( ResultFormat, {controller}/{action}/{id}.{resultFormat}, new { controller = Home, action = Index,

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.