RE: Setting a default order for a model?

Thanks,
Jason

I’d recommend defining a custom method:

class Room < ActiveRecord::Base
def self.find_ordered(first=‘name’, second=‘room_number’)
self.find(:all, :order => “buildings.#{first}, #{second}”,
:include => :building)
end
end

Then just do: @rooms = Room.find_ordered

Regards,

Dan

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