Limit user to 1 like?
问题 How can we limit a user to 1 like per comment? comments_controller.rb def like @comment = Comment.find(params[:id]) @comment.increment!(:likes) @comment.create_activity :like flash[:success] = 'Thanks for liking!' redirect_to(:back) end _comments.html.erb <% @comments.each do |comment| %> <%= User.find(comment.user_id).name %> <%= simple_format comment.content %> <%= pluralize(comment.likes, 'like') %> <%= link_to content_tag(:span, '', class: 'glyphicon glyphicon-thumbs-up') + ' Like it',