Acts As List

Acts as list

This act provides the capabilities for sorting and reordering a number of objects in list.

The class that has this specified needs to have a “position” column defined as an integer on the mapped database table.

Todo list example

class TodoList extends ActiveRecord
{
    var $has_many = array('todo_items', array('order' => "position"));
}
 
class TodoItem extends ActiveRecord
{
    var $belongs_to = 'todo_list';
    var $acts_as = array('list' => array('scope' => 'todo_list'));
}
 
$TodoList =& new TodoList();
 
$TodoList->list->moveToBottom();

Configuration options

  • column - specifies the column name to use for keeping the position integer (default: position)
  • scope - restricts what is to be considered a list.

More information

 
acts-as-list.txt · Last modified: 2008/03/13 16:44 by thijs
 

The Akelos Framework was created by Bermi Ferrer and other contributors.
Potions of the code and documentation have been ported from Ruby on Rails.

The Akelos Framework is released under the LGPL license.

"Akelos", "Akelos Framework", and the Akelos logo are trademarks of Bermi Labs All rights reserved.

Wiki driven by DokuWiki