title: Adding an object in a has_and_belongs_to_many association with Rails
body: <p>I have this simple has_and_belongs_to_many association between users, which works perfectly. </p>
  
  <p>However, I would like to add a friendship relation between all new users created and the first user (yup, just like MySpace's Tom), directly in the Create method:</p>
  
  <pre><code>def create
    @user = User.new(params[:user])
    if @user.save
      @user.friends &lt;&lt; User.find(1)
      redirect_to root_path
    else
      render :action =&gt; :new
    end
  end
  </code></pre>
  
  <p>I don't understand why this doesn't work. No error, nothing, it just doesn't add the first User to the new user's friends.</p>
  
  <p>(for information, I'm using Rails 2.3.4)</p>
  
  <p>What should I do?</p>
  
  <p>Kevin</p>