Model class objects that are not columns in the database

The following code is surely not working as it is, as i cant even remember the proper format of a DATE column in mysql from the top of my head, but maybe it helps to push you in the rioght direction:

def find_by_year(year) find :all, :conditions => ["date >= '?-01-01' AND date <= '?-12-31'",year,year] end

def year self.date.year end

that should enable you to do something like:

Model.find_by_year(2001)

and

SomeModelInstance.year