:order question

Hi!
I’ve two models:
Project has_many :works
Work belongs_to :project

Work contains :year_start and :year_end

I’ve setup a class method to retrieve the first and last year of my
Project.works

How could I get projects ordered by ‘first’ year?

Thanks,
Ettore

That should do:

Projects.find(:all, :include => ‘works’, :order => ‘works.year_start’)

Regards,

Nicolas

Thanks Nicolas, It works perfectly!

Il giorno 02/mag/06, alle ore 14:43, Nicolas B. ha scritto:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs