title: ruby on rails TypeError in Users#show - Cannot visit Like
body: <p><em>form that causes the problem:</em></p>
  
  <pre><code>&lt;%= form_for Like.find(post.user.likes), :html =&gt; { :method =&gt; :delete , :class =&gt; "unlike_post_like_form" } do |f| %&gt;
  </code></pre>
  
  <p><strong>Post model</strong></p>
  
  <pre><code>belongs_to :user
  has_many :likes
  </code></pre>
  
  <p><strong>User model</strong></p>
  
  <pre><code>  has_many :posts
    has_many :likes
  </code></pre>
  
  <p><strong>Like model</strong></p>
  
  <pre><code>  belongs_to :post
    belongs_to :user
  </code></pre>
  
  <p>i keep getting the following error:</p>
  
  <pre><code>TypeError in Users#show 
  Cannot visit Like
  </code></pre>
  
  <p>on </p>
  
  <pre><code>Like.find(post.user.likes),
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p><strong>First solution:</strong></p>
  
  <p>changing</p>
  
  <pre><code>Like.find(post.user.likes),
  </code></pre>
  
  <p>to</p>
  
  <pre><code>Like.find(post.user.likes).limit(1),
  </code></pre>
  
  <p><strong>Second solution:</strong></p>
  
  <p>changing</p>
  
  <pre><code>Like.find(post.user.likes),
  </code></pre>
  
  <p>to</p>
  
  <pre><code>current_user.likes.where(:post_id =&gt; post.post_id)
  </code></pre>