links rewrite

An article by Gaspard Bucher

The problem with links is that it was written long before multi-site implementation and before status/comment attributes on links. The code is such a mess that it has become very brittle.

todos

  1. better dynamic attributes
  2. better schema
  3. gem
  4. links rewrite
  5. tagging system
  6. test

links / relations

relation vs link

A Link “joins” two nodes together defining roles for these nodes through the Relation . Some relations are many-to-many, some are many-to-one and some are one-to-one. Depending on the relation type, “joining” two nodes can suppress or update a previous link:

links_update

When updating link B (change source), link A is destroyed since there can be only one icon for a node.

features

What do we need from the new rewrite of links/relations ?

  • dynamic methods for nodes (icon_id=, icon_status=, icon_for_ids=, ...).
  • check drive/write rights on source/target(s).
  • loading of link_id in nodes (used by ‘unlink’).

who does what

The current implementation of links (July 2008) is a total mess because it is not clear which part does the job. In the beginning, the creation/update of links was done through the node itself, after save. The trigger for update should still be there most of the time but the part that really has all the knowledge to do things properly is the Relation proxy, a Relation that is aware of the context (has a start node).

links_resp

comments

  1. Sunday, July 20 2008 09:06 Gaspard Bucher

    Implementation finished ! (ticket)

  2. leave a comment