Railsify!

relation_browser

relation_browser


Based on RelationBrowser written by Moritz Stefaner (http://der-mo.net)
RelationBrowser is released under a Creative Commons license, please refer to
the file rb_license.txt for details.

RelationBrowser is a Flash application that provides a visually appealing view 
of relationships between objects. This plugin makes it trivial to use 
RelationBrowser with your rails application.

Requirements


You need to have "acts_as_nested_set" declared in the models you want to use
the plugin for. You'll also want to have parent/child relationships setup to
see anything useful!  Alternatively you can implement your own system for 
creating a hierarchy, you just need to provide the following methods: 
full_set, children, direct_children

I also recommend the BetterNestedSet plugin which extends acts_as_nested_set
with some further useful methods and optimizations: 
http://opensource.symetrie.com/trac/better_nested_set/


In the controllers you want to use this on, add the following:
relation_browser :<model name>

Where :<model name> is optional and only needed if the model name doesn't 
match the controller name or can't be determined by the plugin.


Usage

You'll be automatically provided 3 new methods for your controller:

relationships = the main browser
root/<id> = the base relationships in XML that RelationBrowser can load
children/<id> = XML output for specific object relationships

Example:
  http://localhost:3000/things/relationships/1
  http://localhost:3000/things/root/1 <-- tree starting point XML output
  http://localhost:3000/things/children/3 <-- children of thing XML output

Last updated: September 23, 2007 15:53