<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>blog.dnite.org - HowTo: has_many_friends Comments</title>
  <id>tag:blog.dnite.org,2008:/2007/6/8/howto-has_many_friends/comments</id>
  <generator version="0.8.0" uri="http://mephistoblog.com">Mephisto Drax</generator>
  <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends/comments.xml" rel="self" type="application/atom+xml"/>
  <link href="/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
  <updated>2008-06-16T12:08:55Z</updated>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Maran</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:7965</id>
    <published>2008-06-16T12:08:55Z</published>
    <updated>2008-06-16T12:08:55Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Maran</title>
<content type="html">&lt;p&gt;To answer my own question:&lt;/p&gt;


	&lt;p&gt;It&#8217;s &#8220;has_many_friends&#8221; and not &#8220;has_many :friends&#8221;&lt;/p&gt;


	&lt;p&gt;Doh!&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Maran</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:7929</id>
    <published>2008-06-15T14:41:35Z</published>
    <updated>2008-06-15T14:41:35Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Maran</title>
<content type="html">&lt;p&gt;I get &#8220;uninitialized constant User::Friend&#8221; when I try @user.friends&lt;/p&gt;


	&lt;p&gt;What am I doing wrong?&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Mustafa</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:7362</id>
    <published>2008-06-01T04:19:41Z</published>
    <updated>2008-06-01T04:19:41Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Mustafa</title>
<content type="html">&lt;p&gt;Hey,&lt;/p&gt;


	&lt;p&gt;I dont know how it happened to only me but when I request_friendship_with a user, it adds two rows to the database and then it gives 500 Internal Server Error.&lt;/p&gt;


	&lt;p&gt;In the development log I see that rails goes into a infinite loop then mysel breaks up the connection. the infinite loop is:
  [4;36;1mUser Load (0.004551)[0m   [0;1mSELECT * &lt;span class=&quot;caps&quot;&gt;FROM&lt;/span&gt; `users` &lt;span class=&quot;caps&quot;&gt;WHERE&lt;/span&gt; (`users`.`id` = 3) [0m
  [4;35;1mUser Load (0.004514)[0m   [0mSELECT * &lt;span class=&quot;caps&quot;&gt;FROM&lt;/span&gt; `users` &lt;span class=&quot;caps&quot;&gt;WHERE&lt;/span&gt; (`users`.`id` = 3) [0m
  [4;36;1mUser Load (0.004434)[0m   [0;1mSELECT * &lt;span class=&quot;caps&quot;&gt;FROM&lt;/span&gt; `users` &lt;span class=&quot;caps&quot;&gt;WHERE&lt;/span&gt; (`users`.`id` = 3) [0m
  [4;35;1mUser Load (0.004719)[0m   [0mSELECT * &lt;span class=&quot;caps&quot;&gt;FROM&lt;/span&gt; `users` &lt;span class=&quot;caps&quot;&gt;WHERE&lt;/span&gt; (`users`.`id` = 3) [0m
..&lt;/p&gt;


	&lt;p&gt;..&lt;/p&gt;


	&lt;p&gt;then,
Mysql::Error: Lost connection to MySQL server during query: &lt;span class=&quot;caps&quot;&gt;SELECT&lt;/span&gt; * &lt;span class=&quot;caps&quot;&gt;FROM&lt;/span&gt; `users` &lt;span class=&quot;caps&quot;&gt;WHERE&lt;/span&gt; (`users`.`id` = 3) [0m
/!\ &lt;span class=&quot;caps&quot;&gt;FAILSAFE&lt;/span&gt; /!\  Sat May 31 17:40:55 +0300 2008
  Status: 500 Internal Server Error&lt;/p&gt;


	&lt;p&gt;I dont know the reason but I use rails 2.0.2
thanks!&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Jez</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:7040</id>
    <published>2008-05-22T14:41:25Z</published>
    <updated>2008-05-22T14:41:25Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Jez</title>
<content type="html">&lt;p&gt;swapnil,&lt;/p&gt;


	&lt;p&gt;If you use the generator (as described in the readme), it creates the model for you.
All you do the is add the has_many_friends to the User.rb file and you&#8217;re sorted.&lt;/p&gt;


	&lt;p&gt;Brilliant plugin &#8211; was just about to write all this and happened to stumble upon it.  Saved me hours, cheers!&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>swapnil</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:5368</id>
    <published>2008-03-31T04:56:07Z</published>
    <updated>2008-03-31T04:56:07Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by swapnil</title>
<content type="html">&lt;p&gt;Actually, I&#8217;m new to &lt;span class=&quot;caps&quot;&gt;ROR&lt;/span&gt;. In my project I have to create a frendship model . I was thinking of using this has_many_friends. So installed it. But there are no any methods in controller and model as well after installation also??? Did i&#8217;ve to write the methods myself???Plz let me know&#8230;......Also I&#8217;m using the salted_hash_login generator whether this has_many_friends works in the combination with the generator I&#8217;ve used or not&#8230;......Will be waiting for your suggestions&#8230;.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>swapnil</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:5367</id>
    <published>2008-03-31T04:55:49Z</published>
    <updated>2008-03-31T04:55:49Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by swapnil</title>
<content type="html">&lt;p&gt;Actually, I&#8217;m new to &lt;span class=&quot;caps&quot;&gt;ROR&lt;/span&gt;. In my project I have to create a frendship model . I was thinking of using this has_many_friends. So installed it. But there are no any methods in controller and model as well after installation also??? Did i&#8217;ve to write the methods myself???Plz let me know&#8230;......Also I&#8217;m using the salted_hash_login generator whether this has_many_friends works in the combination with the generator I&#8217;ve used or not&#8230;......Will be waiting for your suggestions&#8230;.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Dondi</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:3811</id>
    <published>2008-01-31T23:43:03Z</published>
    <updated>2008-01-31T23:43:03Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Dondi</title>
<content type="html">&lt;p&gt;Thanks for the great plugin Steve! I am using RESTful Authentication w/ email notification (via ActionMailer) in my app. I would like to integrate has_many_friends to add friends capability with the following twist:&lt;/p&gt;


	&lt;p&gt;&#8212;&amp;gt; Fred wants to invite Wilma to be a friend but Wilma has not yet registered on the site&lt;/p&gt;


	&lt;p&gt;To affect this, I imagine something like this is required:&lt;/p&gt;


	&lt;p&gt;&#8212;&amp;gt; An &#8220;invite a Friend&#8221; link opens a form to collect username, email address and default password&lt;/p&gt;


	&lt;p&gt;&#8212;&amp;gt; The form input is processed and drives something like &#8220;fred.create_user_and_request_friendship_with(wilma)&#8221;&lt;/p&gt;


	&lt;p&gt;&#8212;&amp;gt; The &#8220;fred.create_user_and_request_friendship_with(wilma)&#8221; method creates a user with login &#8220;wilma&#8221; and initiates creation of a boiler plate invite email&lt;/p&gt;


	&lt;p&gt;&#8212;&amp;gt; The invite email is addressed to Wilma from Fred, and has an &#8220;activation link&#8221; that includes Wilma and Fred&#8217;s usernames, e.g., &#8220;Hey Wilma, you really need to join my inner circle on this cool site. Just click &lt;span class=&quot;caps&quot;&gt;THIS&lt;/span&gt; link to signup.&#8221;&lt;/p&gt;


	&lt;p&gt;&#8212;&amp;gt; The signup link maps to a User controller / activation method that activates Wilma as a new user and accepts Fred&#8217;s friendship request&lt;/p&gt;


	&lt;p&gt;Any pointers on if/how has_many_friends can be extended to allow this?&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Aleksandr</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:3074</id>
    <published>2008-01-01T12:09:07Z</published>
    <updated>2008-01-01T12:09:07Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Aleksandr</title>
<content type="html">&lt;p&gt;Also improved the is_friends_with? method. Before that it loaded all the friends to check if a user is included in the Array. This is an expensive operation.&lt;/p&gt;


I think this is a little better:
&lt;pre&gt;&lt;code&gt;
def is_friends_with?(friend)
    Friendship.count(:limit =&amp;gt; 1, :conditions =&amp;gt; ['((user_id = ? AND friend_id = ?) OR (friend_id = ? AND user_id = ?)) AND friendships.accepted_at is not null', self.id, friend.id, self.id, friend.id]) &amp;gt; 0
end
&lt;/code&gt;&lt;/pre&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Aleksandr</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:3038</id>
    <published>2007-12-30T11:10:43Z</published>
    <updated>2007-12-30T11:10:43Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Aleksandr</title>
<content type="html">I made the function a little more Rails friendly
&lt;pre&gt;&lt;code&gt;
def friends
    User.find(:all, :select =&amp;gt; &quot;distinct users.*&quot;,
                    :from =&amp;gt; 'users, friendships',
                    :conditions =&amp;gt; [&quot;((friendships.user_id = users.id AND friendships.friend_id = ?) 
                      OR (friendships.friend_id = users.id AND friendships.user_id = ?)) 
                      AND friendships.accepted_at is not null&quot;, self.id, self.id])
  end&lt;/pre&gt;&lt;/code&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Aleksandr</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:3036</id>
    <published>2007-12-30T10:08:03Z</published>
    <updated>2007-12-30T10:08:03Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Aleksandr</title>
<content type="html">&lt;p&gt;mike: This happens because the friends method returns an Array. And an Array does not have a paginate method. Use the fix above from joost.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>lukey</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:2793</id>
    <published>2007-12-14T17:15:03Z</published>
    <updated>2007-12-14T17:15:03Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by lukey</title>
<content type="html">&lt;p&gt;Hi Steve,&lt;/p&gt;


	&lt;p&gt;This is an amazing plugin that am usinf for my upcoming project, but I have a small problem, am able to get a list of all friends a user has with this:&lt;/p&gt;


	&lt;p&gt;@friends = @user.friends&lt;/p&gt;


	&lt;p&gt;but when I gives this:&lt;/p&gt;


	&lt;p&gt;@friends = @user.friends.paginate :page =&amp;gt; params[:page], :per_page =&amp;gt; 10&lt;/p&gt;


	&lt;p&gt;I get the following error:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;NoMethodError in FriendsController#list_friends&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;undefined method `to_i&#8217; for {:page=&amp;gt;nil, :per_page=&amp;gt;10}:Hash&lt;/p&gt;


	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;RAILS&lt;/span&gt;_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace&lt;/p&gt;


	&lt;p&gt;F:/InstantRails/rails_apps/serious/vendor/plugins/will_paginate/lib/will_paginate/collection.rb:14:in `initialize&#8217;
F:/InstantRails/rails_apps/serious/vendor/plugins/will_paginate/lib/will_paginate/collection.rb:21:in `new&#8217;
F:/InstantRails/rails_apps/serious/vendor/plugins/will_paginate/lib/will_paginate/collection.rb:21:in `create&#8217;
F:/InstantRails/rails_apps/serious/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb:37:in `paginate&#8217;
F:/InstantRails/rails_apps/serious/app/controllers/friends_controller.rb:83:in `list_friends&#8217;&lt;/p&gt;


	&lt;p&gt;Could you please guide me with this&#8230;&lt;/p&gt;


	&lt;p&gt;Cheers&lt;/p&gt;


	&lt;p&gt;Lukey&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Mike</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:2362</id>
    <published>2007-11-27T00:37:04Z</published>
    <updated>2007-11-27T00:37:04Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Mike</title>
<content type="html">&lt;p&gt;Hi there,&lt;/p&gt;


	&lt;p&gt;Is it possible to use the :include function (or any other eagerLoading method) to preload some other user associations (in my case I have a separate model for user_images)&lt;/p&gt;


	&lt;p&gt;In my user model I have:&lt;/p&gt;


	&lt;p&gt;has_one: user_image&lt;/p&gt;


	&lt;p&gt;thnx&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>ocher</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:2261</id>
    <published>2007-11-23T15:17:45Z</published>
    <updated>2007-11-23T15:17:45Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by ocher</title>
<content type="html">&lt;p&gt;Hi,&lt;/p&gt;


	&lt;p&gt;joost, there is a small bug in your &#8216;friends&#8217; method. There should be additional parentheses around OR statement:&lt;/p&gt;


	&lt;p&gt;select distinct users.* from users, friendships
      where ((friendships.user_id = users.id and friendships.friend_id = #{self.id})
      or (friendships.friend_id = users.id and friendships.user_id = #{self.id}))
      and friendships.accepted_at is not null&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>joost</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:1719</id>
    <published>2007-11-09T09:54:05Z</published>
    <updated>2007-11-09T09:54:05Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by joost</title>
<content type="html">&lt;p&gt;The answer to my own question:&lt;/p&gt;


	&lt;p&gt;I&#8217;ve replaced the friends instance method with this:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;def friends
  User.find_by_sql &quot;select distinct users.* from users, friendships
    where ( friendships.user_id = users.id and friendships.friend_id = #{self.id} )
    or ( friendships.friend_id = users.id and friendships.user_id = #{self.id} )
    and friendships.accepted_at is not null&quot; 
end&lt;/code&gt;&lt;/pre&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>joost</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:1637</id>
    <published>2007-11-05T16:42:57Z</published>
    <updated>2007-11-05T16:42:57Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by joost</title>
<content type="html">&lt;p&gt;This plugin works great! There is one feature I&#8217;d like to see though&#8230; The friends method currently returns a regular Array (friends_for_me + friends_by_me). This is problematic when someone has a &lt;span class=&quot;caps&quot;&gt;HUGE&lt;/span&gt; number of friends. It&#8217;s also klugdy if you want to paginate this array. It can be done using will_paginate, but it&#8217;s not very clean.&lt;/p&gt;


	&lt;p&gt;Is there a way for the friends method to become a normal resultset like User.find :all?&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>captproton</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:935</id>
    <published>2007-09-19T02:36:45Z</published>
    <updated>2007-09-19T02:36:45Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by captproton</title>
<content type="html">&lt;p&gt;Thanks for the plugin!  
This got me thinking in the right direction for a friends quizzing friends website.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>matthewvb</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:645</id>
    <published>2007-09-05T03:06:44Z</published>
    <updated>2007-09-05T03:06:44Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by matthewvb</title>
<content type="html">&lt;p&gt;steve:
thanks for the updates!&lt;/p&gt;


	&lt;p&gt;question &#8211; is there a way in your current structure to pull say, all the friends of someone based off their extra attributes?&lt;/p&gt;


	&lt;p&gt;for example: I want to pull all of Bobby&#8217;s friends who were added &amp;lt; 30 days_ago.&lt;/p&gt;


	&lt;p&gt;Do you have a find statement like that? or is the best way just to pull a new find out of the Friendship model and sort through that way?&lt;/p&gt;


	&lt;p&gt;Thanks!
-matthew&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Steve</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:630</id>
    <published>2007-09-04T08:00:29Z</published>
    <updated>2007-09-04T08:00:29Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Steve</title>
<content type="html">&lt;p&gt;@matt: I think I just added the is_ for the readability of it. Not sure exactly. Just looked fun. x=)&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Matt</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:591</id>
    <published>2007-09-02T00:28:01Z</published>
    <updated>2007-09-02T00:28:01Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Matt</title>
<content type="html">&lt;p&gt;Isn&#8217;t the &#8220;is&#8221; part of the method call implied by the &#8221;?&#8221; at the end?  When I saw the difference in documentation vs. source I was thinking the source changed first, not the documentation.  Why add the is?&lt;/p&gt;


	&lt;p&gt;-matt&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Steve</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:521</id>
    <published>2007-08-28T01:59:23Z</published>
    <updated>2007-08-28T01:59:23Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Steve</title>
<content type="html">&lt;p&gt;@matthew: Thanks again, buddy. I fixed up those errors in the repository. Should have looked over the whole file but never thought about it at the time cause I was pressed for time. Thanks a lot for bringing it to my attention! x=)&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>matthewvb</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:493</id>
    <published>2007-08-26T00:32:21Z</published>
    <updated>2007-08-26T00:32:21Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by matthewvb</title>
<content type="html">&lt;p&gt;two more things to update:&lt;/p&gt;


	&lt;p&gt;on the readme: the method is called destroy_friendship_with&#8212;not delete&lt;/p&gt;


	&lt;p&gt;in line 115 you need to add the &#8220;is&#8221; like above.&lt;/p&gt;


	&lt;p&gt;Hope this helps!
-matthewvb&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>matthewvb</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:492</id>
    <published>2007-08-26T00:19:14Z</published>
    <updated>2007-08-26T00:19:14Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by matthewvb</title>
<content type="html">&lt;p&gt;Steve,&lt;/p&gt;


	&lt;p&gt;You need to update the plugin lib\has_many_friends.rb @ line 103 to say :friendshipped_for_me =&amp;gt; friend) unless self.is_friends_or_pending_with?(friend) || self == friend&lt;/p&gt;


	&lt;p&gt;(need to add the &#8220;is&#8221;)&lt;/p&gt;


	&lt;p&gt;Seems that broke with the update.
Thanks!
-matthew&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>matthewvb</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:485</id>
    <published>2007-08-25T11:22:14Z</published>
    <updated>2007-08-25T11:22:14Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by matthewvb</title>
<content type="html">&lt;p&gt;@Steve&lt;/p&gt;


	&lt;p&gt;Thanks!! No worries&#8212;I really appreciate the awesome plug-in and help!&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Steve</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:482</id>
    <published>2007-08-25T07:13:30Z</published>
    <updated>2007-08-25T07:13:30Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Steve</title>
<content type="html">&lt;p&gt;@mattew: I&#8217;m sorry, buddy. I must have updated the &lt;span class=&quot;caps&quot;&gt;README&lt;/span&gt; with the method names that I was going to use and forgot to update the method names in the actual plugin. I have since fixed it. If you update to the latest (revision 9), I have updated the methods in the plugin as well.&lt;/p&gt;


	&lt;p&gt;For those people who have been using the old user.friends_with? method, either don&#8217;t update past revision 7 (since the &lt;span class=&quot;caps&quot;&gt;ONLY&lt;/span&gt; thing that changed in revision 8 is the addition of is_ to the few methods that state it in the &lt;span class=&quot;caps&quot;&gt;README&lt;/span&gt;) or if you do update the plugin, update those methods to use the new is_friends_with? terminology.&lt;/p&gt;


	&lt;p&gt;Sorry about this, guys.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>matthewvb</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:478</id>
    <published>2007-08-25T03:05:59Z</published>
    <updated>2007-08-25T03:05:59Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by matthewvb</title>
<content type="html">&lt;p&gt;Steve,&lt;/p&gt;


	&lt;p&gt;I&#8217;m having some problems accessing the: is_friends_with? method. Where is it located in the lib? Any suggestions? When I try to call the method I get a method missing error. The other methods I&#8217;ve tried (accept_friendship_with, etc.) seem to be working great.&lt;/p&gt;


	&lt;p&gt;Thanks for your help! Love your plug-in! Great work!
-matthewvb&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Steve</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:474</id>
    <published>2007-08-24T18:24:36Z</published>
    <updated>2007-08-24T18:24:36Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Steve</title>
<content type="html">&lt;p&gt;@Jim: Your close.. since the result of my plugin is going to be an array with all the items in it, .count doesn&#8217;t work.. you&#8217;ll want to do a .length to get the total items in the array..&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Jim Neath</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:460</id>
    <published>2007-08-24T09:03:30Z</published>
    <updated>2007-08-24T09:03:30Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Jim Neath</title>
<content type="html">&lt;p&gt;Awesome plugin.&lt;/p&gt;


	&lt;p&gt;One problem: how do I display the number of friends a user has? I&#8217;ve tried using @user.friends.count but it just chokes with the following message:&lt;/p&gt;


	&lt;p&gt;undefined method `count&#8217; for []:Array&lt;/p&gt;


	&lt;p&gt;Any ideas?&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Steve</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:308</id>
    <published>2007-08-08T21:17:00Z</published>
    <updated>2007-08-08T21:17:00Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Steve</title>
<content type="html">&lt;p&gt;@Richard: I currently don&#8217;t have any information publicly available for using the online function of this plugin because that part of the plugin was very specialized for my specific needs. If you add a :online_method =&amp;gt; true to the has_many_friends statement in your model, u can use that online method but you&#8217;ll have to customize everything else to meet yours needs. I won&#8217;t have any real documentation about this feature until I can think of an easy way to implement it for everyone. For now, just be creative with it. x=)&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Richard</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:303</id>
    <published>2007-08-08T05:30:44Z</published>
    <updated>2007-08-08T05:30:44Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Richard</title>
<content type="html">&lt;p&gt;Hi Steve,&lt;/p&gt;


	&lt;p&gt;Do you have any info on how to use the online function? I don&#8217;t see how &#8216;offline&#8217;, &#8216;status&#8217;, &#8216;updated_at&#8217; and options[:online_method] come into play and how to set these parameters up in a database etc&#8230;&lt;/p&gt;


	&lt;p&gt;Thanks
-Richard&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>gavin joyce</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:214</id>
    <published>2007-07-16T07:49:04Z</published>
    <updated>2007-07-16T07:49:04Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by gavin joyce</title>
<content type="html">&lt;p&gt;Steve &#8211; great, I&#8217;ll add these checks sometime soon and email you the changes.&lt;/p&gt;


	&lt;p&gt;I have also added two simple yet useful methods:&lt;/p&gt;


	&lt;p&gt;def pending_friends_with_by_me?(friend)
     self.pending_friends_by_me.include? friend
end&lt;/p&gt;


	&lt;p&gt;def pending_friends_with_for_me?(friend)
     self.pending_friends_for_me.include? friend
end&lt;/p&gt;


	&lt;p&gt;Will you add these to the trunk?&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Steve</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:211</id>
    <published>2007-07-14T20:43:02Z</published>
    <updated>2007-07-14T20:43:02Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Steve</title>
<content type="html">&lt;p&gt;@gavin: Of course. Both of those things are very doable. It probably wouldn&#8217;t take much to add a verification method to the plugin that would check both of these things and your more than welcome to edit the plugin as you wish&#8230;&lt;/p&gt;


	&lt;p&gt;@ernst: I created this plugin for a project I was working on and used the &#8216;online now&#8217; method&#8217;s to check to see if users were online but the implimentation was pretty specialized to my situation so I just left the code commented in case someone wanted to try and get it working in their own case.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Gavin Joyce</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:210</id>
    <published>2007-07-14T19:21:57Z</published>
    <updated>2007-07-14T19:21:57Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Gavin Joyce</title>
<content type="html">&lt;p&gt;Also, it is currently possible for duplicate invites to be created. Can we limit to just one?&lt;/p&gt;


	&lt;p&gt;Great plugin btw, ;)&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Gavin Joyce</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:209</id>
    <published>2007-07-14T19:19:44Z</published>
    <updated>2007-07-14T19:19:44Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Gavin Joyce</title>
<content type="html">&lt;p&gt;Hi,&lt;/p&gt;


	&lt;p&gt;Your plugin is fantastic and has saved me hours today. Thanks!!&lt;/p&gt;


	&lt;p&gt;May I suggest a small improvement?&lt;/p&gt;


	&lt;p&gt;In the case where UserA invites UserB, then UserB invites UserA &#8211; should this act as an acceptance?&lt;/p&gt;


	&lt;p&gt;Thanks,
Gavin&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Cass</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:193</id>
    <published>2007-07-11T05:08:46Z</published>
    <updated>2007-07-11T05:08:46Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Cass</title>
<content type="html">&lt;p&gt;Hi Steve,&lt;/p&gt;


	&lt;p&gt;Thank you, I looked through them and it works wonderfully, this is an amazing plugin. Way to go!&lt;/p&gt;


	&lt;p&gt;Cheers&lt;/p&gt;


	&lt;p&gt;Cass&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Steve</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:187</id>
    <published>2007-07-08T19:02:21Z</published>
    <updated>2007-07-08T19:02:21Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Steve</title>
<content type="html">&lt;p&gt;@cass: If you look through the &lt;span class=&quot;caps&quot;&gt;README&lt;/span&gt; file you&#8217;ll see how to finish up installation. There&#8217;s a generator included that will make a migrations for your friendship model for you. You don&#8217;t need a friends model because the User&#8217;s are self referencing other users.&lt;/p&gt;


	&lt;p&gt;@byran: Thanks for the compliments.. Just curious, which example code wasn&#8217;t quite right? I was trying to keep this tutorial more geared at concepts on how to use the plugin than code examples, but I&#8217;d still love to know which examples were &#8216;off&#8217; to you. Thanks again.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Cass</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:185</id>
    <published>2007-07-08T13:50:22Z</published>
    <updated>2007-07-08T13:50:22Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Cass</title>
<content type="html">&lt;p&gt;Hi&lt;/p&gt;


	&lt;p&gt;I am a newbie to ruby.&lt;/p&gt;


	&lt;p&gt;I installed the has_many_friends plugin and now I am confused about this. What should be the fields in friendship table? And do I need a friends table too? If so what should be the fields in the friends table?&lt;/p&gt;


	&lt;p&gt;Honestly, am not able to understand how it works.&lt;/p&gt;


	&lt;p&gt;Any help is tremendous.&lt;/p&gt;


	&lt;p&gt;Cheers
Cass&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>bryan</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:164</id>
    <published>2007-06-29T22:33:04Z</published>
    <updated>2007-06-29T22:33:04Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by bryan</title>
<content type="html">&lt;p&gt;this is very kick ass.  you&#8217;ve done an awesome job.  the documentation isn&#8217;t quite right but the code itself works very, very nicely.&lt;/p&gt;


	&lt;p&gt;word to the wise (aka, anyone else who downloads this): look at the code if something&#8217;s not working.  you&#8217;ll most likely see the example code just wasn&#8217;t quite right.&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Andre</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:151</id>
    <published>2007-06-25T13:14:14Z</published>
    <updated>2007-06-25T13:14:14Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Andre</title>
<content type="html">&lt;p&gt;Fantastic job. This will come in really handy in for my new site. Thanks!&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>ernst</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:140</id>
    <published>2007-06-20T13:47:43Z</published>
    <updated>2007-06-20T13:47:43Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by ernst</title>
<content type="html">&lt;p&gt;hi,
thanks very much for your plug-in, i&#8217;ve been looking for something like that for a long time.
one thing: i&#8217;ve browsed the source and discovered something like &#8220;online_friends&#8221;. could you explain in a few words what this is and how to use it? is it at all already available for use? what about the &#8220;65.seconds.ago&#8221;?
thanks again
bye,
ernst&lt;/p&gt;</content>  </entry>
  <entry xml:base="http://blog.dnite.org/">
    <author>
      <name>Ben Tucker</name>
    </author>
    <id>tag:blog.dnite.org,2007-06-08:73:130</id>
    <published>2007-06-15T19:07:35Z</published>
    <updated>2007-06-15T19:07:35Z</updated>
    <link href="http://blog.dnite.org/2007/6/8/howto-has_many_friends" rel="alternate" type="text/html"/>
    <title>Comment on 'HowTo: has_many_friends' by Ben Tucker</title>
<content type="html">&lt;p&gt;Thanks for this really useful plugin!&lt;/p&gt;


	&lt;p&gt;Tiny typo in the &lt;span class=&quot;caps&quot;&gt;README&lt;/span&gt;: the &#8220;is_friends_with?&#8221; method is really &#8220;friends_with?&#8221;&lt;/p&gt;</content>  </entry>
</feed>
