ordering an acts_as_tree relationship
- by timpone
I have a Category class that is defined like this:
class Catergoy < ActiveRecord::Base
acts_as_tree :parent_id
I'd like the ordering to be by the position value which is a float such that:
category-1
category-2, parent_id=1, position=0.5
category-3, parent_id=2,
category-4, parent_id=1, position=1
How would I specify this?
I tried
acts_as_tree :parent_id :order => :position
acts_as_tree :parent_id, :order => :position
but these are not working. Any ideas how to specify this relationship? Or if I'm missing something else?
thx in advance