Just another syntax question


#1

Drag list order

I have an ‘each do’ loop iterating through the results
of an ‘ordered’ ‘DB.find’ . It appears that regardless of
the order of the ‘find’, the ‘each do’ loop serves it up and
displays in the order of the ‘DB.id’ ie id ‘1’ first ‘id’ 2 second etc.

However I wish the order as viewed to not be in the order
of the ‘id’ field but in the order of another field in the DB
which is changed by the drag action.
ie each do by some other field than id

Cant quite get a handle on the syntax -
some variation of the each do or something else entirely
or am I missing the bleedin obvious


#2

Try adding something like

:order => "column_name DESC"

to your find as in

DB.find(:all, :order => "column_name DESC")

where column_name is the column you wish to order by. DESC can also
be ASC I assume.