Module LiveTree::ClassMethods
In: live_tree.rb

Methods

live_tree  

Public Instance methods

Sets up this controller to serve data for a LiveTree.

Arguments:

  • name - the tree’s name.
  • options - may contain:
    • :model - name of the model to use for retrieving data (symbol).
    • :model_class - name of the model’s class, incase it can’t be inferred (string)
    • :get_item_name_proc - proc object which, when called with an item, returns the name of the item to display.

Either one of :model or :model_class must be specified.

If :get_item_name_proc is not specified, the item’s name attribute is used.

This example sets up this controller to serve data for a tree with name family_tree, that uses the person model to get data:

    class FamilyController < ApplicationController
            live_tree :family_tree, :model => :person
    end

A data retrieval method is created that is named <name>_live_tree_data (e.g. family_tree_live_tree_data)

[Validate]