Is 'position' a magical field?

I’m looking at the typo (blog software) source. The categeries table
has a position field which holds the order that the categories should
appear on the blog. The field appears automagically populated when
creating a new record or deleting an existing record, i.e., when a new
category is added, its position is set to 1+max(position), and when a
category is deleted, all the positions are reordered to
1…numberofrecords. But I don’t see how or where this is done.

In category.rb there’s a method to reorder the categories, but this is
not called either on new or destroy.

I put a position field in my own table, but it’s always nil. I’m
stumped.

On Feb 16, 2008, at 17:19 , rubynuby wrote:

I’m looking at the typo (blog software) source. The categeries table
has a position field which holds the order that the categories should
appear on the blog. The field appears automagically populated when
creating a new record or deleting an existing record, i.e., when a new
category is added, its position is set to 1+max(position), and when a
category is deleted, all the positions are reordered to
1…numberofrecords. But I don’t see how or where this is done.

acts_as_list ?

D’oh! Somehow I missed that. It’s only the first line in the
model :slight_smile:

noob is as noob does! thanks