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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:45:59+00:00 2026-06-06T14:45:59+00:00

EDIT: I’ve altered the code to now read: View code: <h3>Your Orders:</h3> <table class=order-items>

  • 0

EDIT: I’ve altered the code to now read:

View code:

<h3>Your Orders:</h3>
<table class="order-items">
<th>Date</th>
<th>Order No.</th>
<th>View Order</th>
<% @orders.each do |order| %>
    <tr>
        <td><%= order.created_at.strftime("%d %b. %Y") %></td>
        <td><%= order.id %></td>
        <td><%= link_to 'Show',  order_path(order) %></td>
    </tr>
<% end %>   
</table>

<p><%= will_paginate @orders %></p>

Controller Code:

@customer = Customer.find(params[:id])
@orders = @customer.orders.paginate page: params[:page], order: 'id desc',
  per_page: 5

Routes:

resources :orders

resources :customers

get 'admin' => 'admin#index'

get 'account' => 'customers#show'

match '/account', :to => 'customers#show'

match'/signup', :to => 'customers#new'

controller :sessions do
  get  'login' => :new
  post 'login' => :create
  delete 'logout' => :destroy
end


resources :users

resources :line_items

resources :carts

get "store/index"

resources :products do
  get :who_bought, on: :member
end

resources :line_items do
  put 'decrease', on: :member
  put 'increase', on: :member
end

root to: 'store#index', as: 'store'

The problem is now that I’m getting the error:

The @orders variable appears to be empty. Did you forget to pass the collection object for will_paginate?

whenever I click on a “Show” link in the list of orders in the view. Tried restarting the server just in case, but can’t get it working :S!

  • 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-06T14:46:00+00:00Added an answer on June 6, 2026 at 2:46 pm

    It should be

    <% @orders.each do |order| %>

    not

    <% @customer.orders.each do |order| %>

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

Sidebar

Related Questions

Edit: I just moved my HTTPRequest code into the onCreate, and now all of
Edit : Solved, there was a trigger with a loop on the table (read
Edit: I'm looking for solution for this question now also with other programming languages.
EDIT: Changed as I have a different issue with the same code 2nd Edit:
Edit Based on suggestions below to send the logic code GUI delegates, I came
EDIT: Please, please , please read the two requirements listed at the bottom of
EDIT: Thank you so much for your answers, you really amaze me with so
[Edit: don't try to understand the whole thing and don't waste your time to
Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code
EDIT: changed the title to fit the code below. I'm trying to retrieve a

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.