Distinguishing between people who have likes to posts and those who have dislikes I want to distinguish between people who have likes to posts and those who have dislikes. I want to find a way to improve my code without thinking it is efficient.

&lt;% if current_user.voted_up_on? @post %&gt;
  &lt;%= link_to "LIKE #{@post.get_upvotes.size}", like_post_path(@post), method: :post, class: "btn btn-outline-primary" %&gt;
  &lt;%= link_to "DISLIKE #{@post.get_downvotes.size}", dislike_post_path(@post), method: :post, class: "btn btn-outline-dark" %&gt;
&lt;% elsif current_user.voted_down_on? @post %&gt;
  &lt;%= link_to "LIKE #{@post.get_upvotes.size}", like_post_path(@post), method: :post, class: "btn btn-outline-dark" %&gt;
  &lt;%= link_to "DISLIKE #{@post.get_downvotes.size}", dislike_post_path(@post), method: :post, class: "btn btn-outline-danger" %&gt;
&lt;% else %&gt;
  &lt;%= link_to "LIKE #{@post.get_upvotes.size}", like_post_path(@post), method: :post, class: "btn btn-outline-dark" %&gt;
  &lt;%= link_to "DISLIKE #{@post.get_downvotes.size}", dislike_post_path(@post), method: :post, class: "btn btn-outline-dark" %&gt;
&lt;% end %&gt;
As  you can easily identify from your code that link_to code for Like and Dislike  are same for all conditions only the class value is changed
so you can use below code it looks more clean:

&lt;% like_class = current_user.voted_up_on? @post ? 'btn-outline-primary' : 'btn-outline-dark' %&gt;
&lt;% dislike_class = current_user.voted_down_on? @post ? 'btn-outline-danger' : 'btn-outline-dark' %&gt;
&lt;%= link_to "LIKE #{@post.get_upvotes.size}", like_post_path(@post), method: :post, class: "btn #{like_class}" %&gt;
&lt;%= link_to "DISLIKE #{@post.get_downvotes.size}", dislike_post_path(@post), method: :post, class: "btn #{dislike_class}" %&gt;