Rails only returns blank page
Posted
by
user2793027
on Stack Overflow
See other posts from Stack Overflow
or by user2793027
Published on 2013-11-07T21:45:16Z
Indexed on
2013/11/07
21:53 UTC
Read the original article
Hit count: 209
I am new to Ruby on Rails and am trying to find all the orders for a given customer and then search through their order and total it all up. However when I try and test the page I only get a blank page, can anyone tell me why that might be? Also I am running Rails v. 2.3.14
<%
# custdisplay.html.erb.rb
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<% # get the customer data from the customer table
@custdata = Customer.find(@data)
@orderinfo = Order.find(:all, :conditions => ["customer_id = ?",@custdata.id])
for i in [email protected]
@total[i] = 0
@orderparts = Orderline.find(:all, :conditions => ["id = ?", @orderinfo[i].id])
for j in [email protected]
@total[j] += @orderparts[i].quantity * @orderparts[i].price
end
end
#for each quanity need to add up the part
if @ordertotals.length > 0
%>
<h1>customer data for customer: <%=@data %></h1>
<table border=1>
<tr>
<td>Order Number</td>
<td>Order Date</td>
<td>Cost of Order</td>
</tr>
<% # for each customer who has this sales rep
# display each customer in a row
for @orderinfo in @ordertotals %>
<tr>
<td><%[email protected]%></td>
<td><%[email protected]_date%></td>
<td><%[email protected]%></td>
</tr>
<% end %>
</table>
<% else # no customers with this sales rep %>
<h1>NO CUSTOMERS FOR SALES REP <%=@salesrepcust%></h1>
<% end %>
© Stack Overflow or respective owner