How would I write methods last and first in class Day? Day contains a field, date, and I want last to return the Day record in the table that has the greatest date and first to return the record that has the smallest date. How do I write the find?
Sam
def last_date find :first, :order => “date DESC” end
def first_date find :first, :order => “date ASC” end
Usage:
@first_day = Day.first_date @last_day = Day.last_date
…i guess something like this, but no guaranties
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.