J'utilise rails3, devise et actes_as_votable
J'ai préparé la vue pour afficher "bookmark" ou "un-bookmark" selon sa situation de vote.
Mais je ne sais pas quoi mettre. Quelqu'un a une idée?
<% 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 %>
Réponses:
1 pour la réponse № 1Tu peux essayer
current_user.voted_for? @community
upd: Exemple de documentation https://github.com/ryanto/acts_as_votable#the-voter
@user.likes @comment1
@user.voted_for? @comment1 # => true