Had to update one of my production Ruby on Rails applications. I've taken the time to install the Subclipse plugin into Aptana and it's oh so smooth now I can develop my application on my work pc, editing and debugging, check the changes into subversion from within Aptana, check the new version out onto my server and rock away.
My application had to do a huge long database query, returning 19,000 records in a .csv file. I had some problems with Apache deciding that the fcgi process had timed out and throwing a 500 error. To resolve this I altered the file /etc/apache2/mods-enabled/fcgid.conf thusly:
<IfModule mod_fcgid.c> AddHandler fcgid-script .fcgi SocketPath /var/lib/apache2/fcgid/sock IPCConnectTimeout 120 IPCCommTimeout 120 </IfModule>
It was the IPCCommTimeout setting that did the trick, it defaults to 20 seconds.
What with such a large recordset I had to introduce paging to the web application so the results can be previewed in something more snappy than a 19,000 row table. I used the will_paginate plugin to implement this and it was unbelievably easy. With the plugin, the changes amount to changing the query for your recordset to something along the lines of:
@posts = Post.paginate( :all, :page => params[:page])
and adding the following to the bottom of the view to get the next/prev/page 1|2|3 business:
<%= will_paginate @posts %>
That's it, the first of 600 pages is thrown up in a few seconds.

