Ruby/Rails content gets a new home

Thanks for all the follows and subscribes, based mainly on my Ruby and Rails problems and solutions series.  Since it has proven to be so popular, I have created a new, specific Posterous site - ror4real, where this series will continue, on a (hopefully) more regular basis. First new post is up today.

Ruby on Rails problems & solutions - Apr 8, 2011

RSpec view debugging hackI needed to see what the rendered view looked like, so I could figure out why it was finding “1151” instead of “1” in a tr>td selector.  I knew how to do this in RSpec 1, but not in RSpec 2.

Ruby on Rails problems & solutions - Feb 23, 2011

Handle divide by zero in select in OracleActually, I could do an entire blog entry, or even an conference session on the topic of avoiding the N+1 query problem when displaying data from legacy databases.  Only in my case, it’s more like 7N+1.  But, let’s just get down to today’s specific case.  I needed to display a table of values, and I wanted to be able to sort the table on any of the columns.  Sorting is most efficiently done by the database, no?  But several of the columns were actually derived data, with simple calculations.  You can still sort on such things, IF you create a custom column aka - “SELECT cola/colb as custom_column FROM …”.  Unfortunately, if colb contains any zeros, the query will blow up.  :-p

Ruby on Rails problems & solutions - Jan 24, 2011

Date Formats for Rails 3 It’s surprisingly difficult to find up-to-date, comprehensive info about date formats and time zones for Rails. It’s been a moving target, updated in every release.  This thread pops up a lot:

Ruby on Rails problems & solutions - Jan 21, 2011

Routes and formats For some reason, I got stuck on this.  It’s not explicitly stated anywhere in the new routing documenation/guides, but if you need a format, it’s a parameter for your path: workbook_job_path(job, :format => ‘pdf’)