Sorting a db result set

hola!

#controller code which gets all the db records:
def list2
@teams = Team.find_all
end

#rhtml code
@teams.each do |team|

the question is how do i do a “sort by” “columnX”?

cheers

mizage wrote:

hola!

#controller code which gets all the db records:
def list2
@teams = Team.find_all
end

@teams = Team.find :all, :order => “columnx”

-Brian

def list2
@teams = Team.find :all, :order => ‘columnX’
end

Kent.

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