title: I cannot make a function to delete likes
body: <p>I try to make simple voting system for comments.
  Just one button "voteup", and if the user has already clicked it, it changes to "delete vote". And everything seems to work, except for the voice removal feature. If I click "delete vote" an error <code>Couldn't find Post with 'id'=11</code> appears.
  And I do not understand why this is so, because this is, in fact, one method that is used both for voting and for removing one's vote. Only in one case does everything work, but in the other not.</p>
  
  <p>votes_controller:</p>
  
  <pre class="lang-rb prettyprint-override"><code>class VotesController &lt; ApplicationController
    before_action :find_comment
    before_action :find_vote, only: [:destroy]
  def create
    if already_voted?
      flash[:notice] = "You can't like more than once"
    else
        @comment.votes.create(author_id: current_author.id)
    end
    redirect_to post_path(@post)
  end
  
  def destroy
    if !(already_voted?)
      flash[:notice] = "Cannot unlike"
    else
      @vote.destroy
    end
    redirect_to post_path(@post)
  end
  
  private
  def find_comment
    @post = Post.find(params[:post_id])
    @comment = Comment.find(params[:comment_id])
  end
  
  def already_voted?
    Vote.where(author_id: current_author.id, comment_id:
    params[:comment_id]).exists?
  end
  
  def find_vote
     @vote = @comment.votes.find(params[:id])
  end
  end
  </code></pre>
  
  <p>Votes  elements in _comment.html.erb:</p>
  
  <pre class="lang-rb prettyprint-override"><code>&lt;% pre_vote = comment.votes.find { |vote| vote.author_id == current_author.id} %&gt;
          &lt;% if pre_vote %&gt;
            &lt;%= button_to 'Delete Vote', post_comment_vote_path(comment, pre_vote), method: :delete %&gt;
          &lt;% else %&gt;
            &lt;%= button_to 'UpVote', post_comment_votes_path(post, comment), method: :post %&gt;
          &lt;% end %&gt;
        &lt;p&gt;&lt;%= comment.votes.count %&gt; &lt;%= (comment.votes.count) == 1 ? 'Like' : 'Likes'%&gt;&lt;/p&gt;
  </code></pre>
  
  <p><strong>UPD</strong>
  This post has id - 3, not 11.
  The comment has id 11.
  For some reason, it confused everything during the removal of like.</p>
  
  <p><strong>UPD 2</strong></p>
  
  <p>Migration:</p>
  
  <pre class="lang-rb prettyprint-override"><code>  def change
      create_table :votes do |t|
        t.references :comment, null: false, foreign_key: true
        t.references :author, null: false, foreign_key: true
  
        t.timestamps
      end
    end
  </code></pre>
  
  <p>vote.rb :</p>
  
  <pre class="lang-rb prettyprint-override"><code>class Vote &lt; ApplicationRecord
    belongs_to :comment
    belongs_to :author
  end
  </code></pre>
  
  <p>comment.rb and author.rb : <code>has_many :votes, dependent: :destroy</code></p>