title: NoMethodError - undefined method 'find_by' for []:ActiveRecord::Relation
body: <p>I've been following Michael Heartl tutorial to create a follow system but I have a strange error: "undefined method `find_by' for []:ActiveRecord::Relation". I'm using devise for authentication.</p>
  
  <p>My view /users/show.html.erb looks like that:</p>
  
  <pre><code>.
  .
  .
  &lt;% if current_user.following?(@user) %&gt;
      &lt;%= render 'unfollow' %&gt;
  &lt;% else %&gt;
      &lt;%= render 'follow' %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>User model 'models/user.rb' :</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  devise :database_authenticatable, :registerable, :recoverable, :rememberable,     :trackable, :validatable
  
  has_many :authentications
  has_many :relationships, foreign_key: "follower_id", dependent: :destroy
  has_many :followed_users, through: :relationships, source: :followed
  has_many :reverse_relationships, foreign_key: "followed_id", class_name: "Relationship", dependent: :destroy
  has_many :followers, through: :reverse_relationships, source: :follower
  
      def following?(other_user)
          relationships.find_by(followed_id: other_user.id)
      end
  
      def follow!(other_user)
          relationships.create!(followed_id: other_user.id)
      end
  
      def unfollow!(other_user)
          relationships.find_by(followed_id: other_user.id).destroy
      end
  
  end
  </code></pre>
  
  <p>Relationship model 'models/relationship.rb':</p>
  
  <pre><code>class Relationship &lt; ActiveRecord::Base
  
    attr_accessible :followed_id, :follower_id
  
    belongs_to :follower, class_name: "User"
    belongs_to :followed, class_name: "User"
  
    validates :follower_id, presence: true
    validates :followed_id, presence: true
  
  end
  </code></pre>
  
  <p>Rails is telling me that the issue is in user model : "relationships.find_by(followed_id: other_user.id)" because mthod is not defined, but I don't understand why ?</p>