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:
@@ -6,7 +6,7 @@ class ForumPostVote < ApplicationRecord
|
|||||||
scope :up, -> {where(score: 1)}
|
scope :up, -> {where(score: 1)}
|
||||||
scope :down, -> {where(score: -1)}
|
scope :down, -> {where(score: -1)}
|
||||||
scope :by, ->(user_id) {where(creator_id: user_id)}
|
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?
|
def up?
|
||||||
score == 1
|
score == 1
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post %>
|
<%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post %>
|
||||||
<% end %>
|
<% 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 %>
|
<%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user