views:

30

answers:

1

I'm using acts_as_list plugin to sort my to do lists.

* [drag] Test 1
* [drag] sadf 2
* [drag] asdf 3 

However I want the numbering to the DESC instead. So it shows as

* [drag] Test 3
* [drag] sadf 2
* [drag] asdf 1

How do I do that?

Thanks

+2  A: 

Try changing the order in the model:

class TodoList < ActiveRecord::Base
  has_many :todo_items, :order => "position DESC"
end

That should produce:

  • asdf 3
  • sadf 2
  • Test 1

assuming your items are:

id name position
1  Test 1
2  sadf 2
3  asdf 3
zetetic
In my model there as just 'acts_as_list' and I was trying to order it and didn't work. However I modified it in my controller and that did the trick. Thanks.
Senthil