I'm unable to check if the current_user is blocking the target user. I'm trying to create a toggle button for the block/unblock feature. I don't know how people were able to do it, unless their solution wasn't AJAX ready. How can I check if the current_user is following the target @user object?
_block_user.html.erb
<% # unless @user == current_user %>
<% **if current_user.blocking?(@user)** %>
<%= link_to(unblock_user_path(@user), :remote => true, :class => 'btn btn-outline-danger') do %>
<i class="fa fa-stop-circle"></i>
Unblock
<% end %>
<% else %>
<%= link_to(block_user_path(@user) ,:remote => true, :class => 'btn btn-outline-primary') do %>
<i class="fa fa-play-circle"></i>
Block
<%end%>
<% end %>
<% # end %>