MySql Memory Error


#1

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 %>

Revenue Summary

Last Month <%= number_to_currency(@stats[:last_month]) %>
Last 30 Days <%= number_to_currency(@stats[:last_30]) %>
This Month <%= number_to_currency(@stats[:this_month]) %>
<% end %>

<%= @page_title %>

<% @subscriptions.each do |subscription| %> <% end %>
Account Amount Created Next Renewal Status
<%= link_to(h(subscription.account.name), [:admin, subscription]) %> <%= number_to_currency(subscription.amount) %> <%= "(# {subscription.discount.name})" if subscription.discount %> <%= subscription.created_at.strftime("%d %B %Y") %> <%= subscription.next_renewal_at.strftime("%d %B %Y") %> <%= subscription.state %>

<%= 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