whoahbot/dm-redis-adapter — Issue #23: DM self-referential associations not working
Author: disbelief
Created: 2011-11-30 13:11:49+00:00
State: open

Please excuse me if this is actually not a problem as I am a bit new to both DataMapper and Redis. However I am following the example code in the DataMapper Associations documentation (http://datamapper.org/docs/associations.html) for creating a Twitter-like follower + followed self-referential association in my User model.

This pastie should illustrate the problem: http://pastie.org/2943832

As you can see, when the association is first created, user1 ends up following himself along with the user he was intended to follow, user2 believes she has one follower, but can't seem to find any links_to_followers. Furthermore, unfollowing seems to leave an orphan association on the followed user's side of the association, and just generally seems to make a mess of things.

It seems that the association isn't being stored in/queried from Redis properly, or perhaps it simply isn't possible to store such a relationship in Redis?