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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:57:25+00:00 2026-06-09T11:57:25+00:00

I have written this in my controller: def index @invoices = Invoice.paginate(:page => params[:page],

  • 0

I have written this in my controller:

 def index
    @invoices = Invoice.paginate(:page => params[:page], :per_page => 3)
    @invoices = Invoice.all(:select=>"invoices.id, invoices.invoice_name, 
                                     invoices.invoice_number, invoices.invoice_date,
                                     invoices.invoice_sent, invoices.current_eta, 
                                     invoices.invoice_status, invoices.invoice_amount, 
                                     projects.project_name, clients.client_name, 
                                     companies.company_name, currencies.symbol as invoice_symbol", 

    :joins => "left outer join projects on invoices.project_id = projects.id
               left outer join clients on projects.client_id = projects.id
               left outer join currencies on currencies.id = projects.currency_id
               left outer join companies on clients.company_id = companies.id",
    :order =>"invoice_name desc")

    if @invoices.blank?
      flash[:notice] = "There are no Invoices defined. You can create them by clicking 'New Invoice'"
    end
    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @invoices }
    end
  end

In my views file I have writte this:

  <div class="digg_pagination">
    <div clas="page_info">
      <%= page_entries_info @invoices %>
    </div>
    <%= will_paginate @invoices, :container => false %>
  </div>

But I am getting this error:

NoMethodError in Invoices#index

Showing /home/icicle/work/code/invoiced/app/views/invoices/_list.html.erb where line #59 raised:

undefined method `total_pages' for #<Array:0xbdfb708>

Extracted source (around line #59):

56: </table>
57:   <div class="digg_pagination">
58:     <div clas="page_info">
59:       <%= page_entries_info @invoices %>
60:     </div>
61:     <%= will_paginate @invoices, :container => false %>
62:   </div>

I also tried to change the version of will_paginate gem but still I am getting the same error. Can someone help me out?

  • 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-09T11:57:26+00:00Added an answer on June 9, 2026 at 11:57 am

    Either rename the 2nd instance variable or instead of all please use paginate

        @invoices = Invoice.paginate(:select=>"invoices.id, invoices.invoice_name, 
                                     invoices.invoice_number, invoices.invoice_date,
                                     invoices.invoice_sent, invoices.current_eta, 
                                     invoices.invoice_status, invoices.invoice_amount, 
                                     projects.project_name, clients.client_name, 
                                     companies.company_name, currencies.symbol as invoice_symbol", 
    
    :joins => "left outer join projects on invoices.project_id = projects.id
               left outer join clients on projects.client_id = projects.id
               left outer join currencies on currencies.id = projects.currency_id
               left outer join companies on clients.company_id = companies.id",
    :order =>"invoice_name desc",:page => params[:page], :per_page => 3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my controller action, I have the following: def index @articles = (params[:mine] ==
I have done a VF page in this pages controller. I have written a
I have written this code outside all functions: int l, k; for (l =
I have written a controller. When I click the button from view, this controller
I want to test this method in my controller. def fetch_match_displayed_count(params) match_count = 0
this is my javascript code ...i have written a function in my controller in
have written this little class, which generates a UUID every time an object of
I have written this code inside a servlet to delete certain records from three
I have written this code in JavaScript and works perfectly fine when I include
I have written this function to auto correct gender to M or F from

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.