I have these two lines in my model, written for PostgreSQL:
named_scope :by_month, lambda { |month| { :conditions => ["EXTRACT(MONTH FROM recorded_on) = ?", month] }}
named_scope :by_year, lambda { |year| { :conditions => ["EXTRACT(YEAR FROM recorded_on) = ?", year] }}
I'm running PostgreSQL in production, but I'm developing with SQLite3. How can I write those lines in a way that is database-agnostic?
Btw, "recorded_on" is formed from the following:
Model.recorded_on = Time.parse("Fri, 01 May 2009 08:42:23 -0400")