ActsAsMaterializedPath
This mixin implements a set of trees (nested set) in a single table.
Within its limitations, this plugin is meant to be more efficient than existing implementations of nested sets.
Example
In the class implementing the trees:
acts_as_materialized_path :delimiter => '.',
:base => 10,
:column => 'materialized_path',
:places => 3,
The values show here are the defaults.
In the migration file, ensure the path_column_name is not null and has a unique index:
t.string :materialized_path, :null => false
add_index(:tree_table, [:materialized_path], :unique => true)
In addition, the collating sequence for ascii representable characters, c, must be ascii or p < n < a, where ispunct(p) && isdigit(n) && isalpha© (this handles UTF-8 collation).
Copyright © 2008 Antony Nigel Donovan, released under the MIT license