Estou usando rails3, devise e ats_as_votable
Eu preparei a vista para mostrar "favorito" ou "desmarcar" dependendo de sua situação de votação.
Mas não tenho ideia do que colocar. Alguém tem ideia?
<% if xxxxxxxxxxxx %> <= *when @community hasn"t been voted by current_user*
<%= link_to t(".bookmark", :default => t("helpers.links.bookmark")),
bookmark_community_path(@community), :class => "btn" %>
<% else %>
<%= link_to t(".unbookmark", :default => t("helpers.links.unbookmark")),
bookmark_community_path(@community), :class => "btn-danger" %>
<% end %>
Respostas:
1 para resposta № 1Podes tentar
current_user.voted_for? @community
upd: Exemplo da documentação https://github.com/ryanto/acts_as_votable#the-voter
@user.likes @comment1
@user.voted_for? @comment1 # => true