forum post votes: fix conflicting scope name.

Fixes a conflict with `Enumerable#excluding` in Rails 6.

    Rename Array#without and Enumerable#without to Array#excluding and
    Enumerable#excluding. Old method names are retained as aliases.
This commit is contained in:
evazion
2019-08-22 20:51:45 -05:00
parent 84f4e076cc
commit 4f5d80bb60
2 changed files with 2 additions and 2 deletions

View File

@@ -6,7 +6,7 @@ class ForumPostVote < ApplicationRecord
scope :up, -> {where(score: 1)}
scope :down, -> {where(score: -1)}
scope :by, ->(user_id) {where(creator_id: user_id)}
scope :excluding, ->(user_id) {where("creator_id <> ?", user_id)}
scope :excluding_user, ->(user_id) {where("creator_id <> ?", user_id)}
def up?
score == 1

View File

@@ -7,7 +7,7 @@
<%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post %>
<% end %>
<% votes.excluding(CurrentUser.user.id).each do |vote| %>
<% votes.excluding_user(CurrentUser.user.id).each do |vote| %>
<%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post %>
<% end %>