[Rails] Graph
Bob Aman
vacindak at gmail.com
Thu Feb 17 23:20:58 GMT 2005
Noob alert. I know barely any Ruby, and I'm just getting started with Rails.
I effectively have a graph data structure in my database, and I'm
trying to figure out how it should get modelled properly into Rails.
Let's say there's a "nodes" table and an "edges" table. The "edges"
table has fields "from_id" and "to_id" as well as several other fields
to describe the edge.
How do I link things so that I can do stuff like:
<% for edge in @node.edges %>
From: <%= edge.from.name %><br />
To: <%= edge.to.name %><br />
Length: <%= edge.length %><br />
<hr />
<% end %>
--
Bob Aman
More information about the Rails
mailing list