Need to be able to add percentage statistics but only select one from browser, color_depth, resolution, operating system. Added 'All' record to these tables then added clause to both various rails order's and sql order by's to get the 'All's to appear first. In the case of months order needed to be ASC, for others rails, DESC, i.e.
find_by_sql("...id order by browser_name_source") find_by_sql("...id order by os_name_source")
@colors = ColorDepth.find(..., :order => 'depth DESC') @statistics_months = StatisticsMonth.find(..., :order => 'month_name ASC') @resolutions = Resolution.find(..., :order => 'resolution DESC')
Tried it out and was mostly ok, except month name by name actually isn't good! However still wanted to avoid find_by_sql, so by combining using month_num '0' for an 'all' record I can
:order => 'month_num ASC'
but display the name and thus get 'All' followed by Jan, Feb, etc.
Always a way.