I am getting the following error when I try the following code.
controller.rb
def index @stats = SubscriptionPayment.stats if params[:page].blank? @subscriptions = Subscription.paginate(:include => :account, :page => params[:page], :per_page => 30, :order => 'accounts.name') end
index.html.erb
<% @page_title = 'Subscriptions' %> <% if @stats %> <h1>Revenue Summary</h1> <table id="stats"> <tr> <th>Last Month</th> <td><%= number_to_currency(@stats[:last_month]) %></td> </tr> <tr> <th>Last 30 Days</th> <td><%= number_to_currency(@stats[:last_30]) %></td> </tr> <tr> <th>This Month</th> <td><%= number_to_currency(@stats[:this_month]) %></td> </tr> </table> <% end %>
<h1><%= @page_title %></h1> <table id="subscriptions"> <tr> <th>Account</th> <th>Amount</th> <th>Created</th> <th>Next Renewal</th> <th>Status</th> </tr> <% @subscriptions.each do |subscription| %> <tr class="<%= 'expired' unless subscription.current? %>"> <td><%= link_to(h(subscription.account.name), [:admin, subscription]) %></td> <td><%= number_to_currency(subscription.amount) %> <%= "(# {subscription.discount.name})" if subscription.discount %></td> <td><%= subscription.created_at.strftime("%d %B %Y") %></td> <td><%= subscription.next_renewal_at.strftime("%d %B %Y") %></
<td><%= subscription.state %></td> </tr> <% end %> </table>
<%= will_paginate(@subscriptions) %>
ERROR
ActiveRecord::StatementInvalid (Mysql::Error: Out of memory (Needed 2096048 bytes):
How do I get around this or fix the current statements?
Thank you,
Sean