Sha256: 8967bb87a59d939d002d92bb719649cceaa2d6dfef0de6bd458ae3396e46b760

Contents?: true

Size: 949 Bytes

Versions: 1

Compression:

Stored size: 949 Bytes

Contents

= Sortable Nested Set

== Requirements

jQuery is required.

== Usage

Add the gem to your Gemfile.

  gem 'sortable_nested_set'

In each "Category" (e.g. "Directory") migration:
  lft:integer
  rgt:integer
  depth:integer [optional]

In the routing configuration file:
  nest the "Category" and "Item" resources

In each "Category" model:
  acts_as_sortable_nested_set_of :items
where :items is the pluralized, underscored "Item" model (e.g. "ImageFile"=>:image_files).

In the "Category" and "Item" controllers:
  [new] use param[:category_id]
  [destroy] respond_to format.js (and provide associated view)

In the "Category" and "Items" models:
  provide #to_s.

In the <head> section of the layout(s) where the trees will be displayed:
  yield(:head)
after jQuery is loaded.

== Support for acts_as_list

When an "Item" model acts_as_list, SortableNestedSet will use its position for sorting.

== Helpers

  sns_options
  sns_lineage
  sns_tree

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sortable_nested_set-0.3.0 README.rdoc