Self Referential Two Way Friends Ruby on Rails Plugin
Posted by dnite on January 26, 2007
UPDATE (3/08/2007) :: I’ve moved my blog and this plugin (an updated version at that) over to http://blog.dnite.org. If you want more information and would also like to download it, head over there. That’s where I’ll be residing from now on.
February 20, 2007 at 8:02 am
hi there,
any plans to put up a subversion repository? it would be great since it’s easy to release update and keep an eye on it.
keep up the good work
February 20, 2007 at 8:14 am
I’ve set up this plugin, here’s what I have so far:
>> @user = User.find(1)
=> #"77888ba4264ad75d7119a30fb11b6d361a33a85a", "activated_at"=>"2007-02-18 20:04:03", "updated_at"=>"2007-02-20 11:54:12", "crypted_password"=>"2fecb7720f944aa38dc2c37437e3554e5c5f7047", "activation_code"=>nil, "remember_token_expires_at"=>"2007-03-06 10:54:12", "group_id"=>"1", "id"=>"1", "remember_token"=>"166712a19a13f02434c943e4232ee64bc3934fdd", "login"=>"kain", "created_at"=>"2007-02-18 21:03:36", "email"=>"masterkain@gmail.xxx"}>
>> @friend = User.find(2)
=> #"773980d0100a7695412ec2bc574adf7bf28ed9ff", "activated_at"=>"2007-02-18 20:18:48", "updated_at"=>"2007-02-20 13:29:15", "crypted_password"=>"4f26d4e01f5ffce2f9f5846afcfa33c5b93e6931", "activation_code"=>nil, "remember_token_expires_at"=>"2007-03-06 12:29:15", "group_id"=>"2", "id"=>"2", "remember_token"=>"5e5a1717739318168794e3c6b504196cf42834a2", "login"=>"elair", "created_at"=>"2007-02-18 21:18:38", "email"=>"elair@elair.xxx"}>
>> @user.is_friends_with(@friend)
=> #>, @friendshipped=#"77888ba4264ad75d7119a30fb11b6d361a33a85a", "activated_at"=>"2007-02-18 20:04:03", "updated_at"=>"2007-02-20 11:54:12", "crypted_password"=>"2fecb7720f944aa38dc2c37437e3554e5c5f7047", "activation_code"=>nil, "remember_token_expires_at"=>"2007-03-06 10:54:12", "group_id"=>"1", "id"=>"1", "remember_token"=>"166712a19a13f02434c943e4232ee64bc3934fdd", "login"=>"kain", "created_at"=>"2007-02-18 21:03:36", "email"=>"masterkain@gmail.com"}, @friends_for_me=[]>, @attributes={”accepted_at”=>Tue Feb 20 14:12:06 +0100 2007, “updated_at”=>Tue Feb 20 14:12:06 +0100 2007, “id”=>1, “user_id”=>1, “friend_id”=>2}, @befriendshipped=#”773980d0100a7695412ec2bc574adf7bf28ed9ff”, “activated_at”=>”2007-02-18 20:18:48″, “updated_at”=>”2007-02-20 13:29:15″, “crypted_password”=>”4f26d4e01f5ffce2f9f5846afcfa33c5b93e6931″, “activation_code”=>nil, “remember_token_expires_at”=>”2007-03-06 12:29:15″, “group_id”=>”2″, “id”=>”2″, “remember_token”=>”5e5a1717739318168794e3c6b504196cf42834a2″, “login”=>”elair”, “created_at”=>”2007-02-18 21:18:38″, “email”=>”elair@elair.org”}>>
>> @user.is_friends_with?(2)
=> false
>> @user.is_friends_with?(@friend)
=> false
>> @user.friends
=> []
what’s wrong here?
thanks.
February 20, 2007 at 12:30 pm
Strange indeed. I have provided this same plugin for a little less than a year now. It is available at http://svn.webwideconsulting.com/svn/friendship_plugin/
We have been using it for several months in production, and on several sites, it works very well. (I also work with ReinH on a daily basis)
March 1, 2007 at 1:15 pm
@kain: I may throw up a subversion repo in the near future after I refactor and rename the plugin. Also, if you post the code u used to impliment the plugin, i might have a better understanding about what’s not working right there. (sorry for the delay in reply, your comment originally got marked as spam)
March 8, 2007 at 4:27 pm
[...] Top Posts Ruby on Rails on UbuntuMore Ruby on Rails with Ubuntu… (rails.vim)Self Referential Two Way Friends Ruby on Rails Plugin [...]