title: uninitialized constant User::follow Extracted source (around line #28):
body: <p>i have an error in my user.rb model (around line #28):</p>
  <pre><code>27def following?(user) 
  28 following.include?(user)
  29end
  
  </code></pre>
  <p>Any idea what I could be doing wrong here?
  Showing C:/instagramm/instagram-clone/app/views/accounts/profile.html.erb where line #11 raised:
  my profile.html.erb :</p>
  <pre><code>&lt;% if @users.image.present %&gt;
  &lt;%= image_tag @users.image %&gt;
  &lt;% end %&gt;
  
  
  &lt;strong&gt;&lt;h1&gt;&lt;%= @users.full_name %&gt;&lt;/h1&gt;&lt;/strong&gt;
  
  &lt;% if user_signed_in? &amp;&amp; @user == current_user %&gt;
  
        &lt;%= link_to&quot;Edit Profile&quot;, edit_user_registration_path(@user) %&gt;
      &lt;% if current_user.following?(@user) %&gt;
          &lt;%= link_to&quot;Unfollow&quot;, follows_path(user_id: @user.id), method: :delete %&gt;
      &lt;% else %&gt;
          &lt;%= link_to&quot;Follow&quot;, follows_path(user_id: @user.id) %&gt;
      &lt;% end %&gt;
  &lt;% end %&gt;
  
  
  &lt;div&gt; &lt;%= @users.posts.count %&gt; Posts &lt;/div&gt;
  
  
  
  
  &lt;p&gt;&lt;%= @users.full_name %&gt;&lt;/p&gt;
  &lt;p&gt;&lt;%= @users.description %&gt;&lt;/p&gt;
  &lt;p&gt;&lt;%= link_to 'User Website', @users.website if @users.website.present? %&gt;&lt;/p&gt;
  
  
  
  &lt;%= @posts.each do |post|%&gt;
  &lt;%= image_tag post.image %&gt;
  &lt;% end %&gt;
  
  </code></pre>
  <p>my model : follow.rb</p>
  <pre><code>class Follow &lt; ApplicationRecord
      
      
  
      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>and this is my user.rb model : the error is around(#line28) in def following?(user)</p>
  <pre><code>class User &lt; ApplicationRecord
  
    has_many :posts 
    validates :username, presence: true 
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :validatable
  
  has_one_attached :image
  
  has_many :active_follows, class_name: &quot;follow&quot;, foreign_key: &quot;follower_id&quot;, dependent: :destroy 
  
  has_many :passive_follows, class_name: &quot;follow&quot;, foreign_key: &quot;followed_id&quot;, dependent: :destroy
  
  has_many :following, through: :active_follows, source: :followed
  has_many :followers, through: :passive_follows, source: :follower
  
  def follow(user)
    active_follows.create(followed_id: user.id)
  end
  
  def unfollow(user)
    active_follows.find_by(followed_id: user.id).destroy 
  end
  
  def following?(user)
  following.include?(user)
  end 
  
  def full_name
    &quot;#{first_name} #{last_name}&quot;
  end
  
  
  
  end
  </code></pre>