From 4f5d80bb60c21a56ba9dbad765de54c11c53fac7 Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 22 Aug 2019 20:51:45 -0500 Subject: [PATCH] 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. --- app/models/forum_post_vote.rb | 2 +- app/views/forum_post_votes/_list.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/forum_post_vote.rb b/app/models/forum_post_vote.rb index 88ee0f0a0..4a987e2bf 100644 --- a/app/models/forum_post_vote.rb +++ b/app/models/forum_post_vote.rb @@ -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 diff --git a/app/views/forum_post_votes/_list.html.erb b/app/views/forum_post_votes/_list.html.erb index 1da894209..77db71503 100644 --- a/app/views/forum_post_votes/_list.html.erb +++ b/app/views/forum_post_votes/_list.html.erb @@ -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 %>