views:

94

answers:

1

I'm trying to prototype a system in Rails. Essentially, its an abstract relational data model that takes in user input to create nodes of information. Each node can have meta-information associated with it, so some nodes may have CreateDate and DueDate while others may have StartDate, DueDate and PersonResponsible. In this way we're simply collecting lots of notes, and attributing information that a person would want to remember in relation to that note. Easy.

What I want to do to build on that is to make each node act as a tag which can be applied to any other node, building trees that can be browsed down with every node leading you to other nodes that are relationally its children. That way you can start by showing a list of your top level nodes (those not tagged by any others) and as each item is focused on, present a list of that node's children (all the other nodes which are tagged by it).

So my question is, which rails plugins should I look into to do this?

A: 

If I understood correctly - the data model you are describing is a graph. Unfortunately ... I haven't found a plugin that implements graphs with all the characteristics you need (acts_ as _ graph plugin cannot do it) so you could try programming the model yourself. You will need 3 tables and 2 active record classes for it (one table is used for the many to many relationship)

Classes

1. Node 
  has_many_and_belongs_to :node 

2. Metadata

  belongs_to :node

Since you need dynamic metadata you can use 2 columns: Name (string), Data (text) but you'll have to serialize data when you put it in the Data field (since you need class information as well as the data so you can use it).

I think this model should be able to hold your data. It's up to you to program the user interface part.

Senad Uka
Wow, thank you! You guys (stackoverflow'ers) are great, I think i'll be sticking around to try to answer some questions myself. Thanks again for the help,~Jordan
Mark the question answered then ... :)
Senad Uka