Skip to content

Commit a568d40

Browse files
committed
Fix Rubocop offenses
1 parent bc2d2d9 commit a568d40

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/controllers/collections_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def save_shared # rubocop:disable Metrics/AbcSize
117117
end
118118

119119
def leave
120-
if @collection.users.count == 1
120+
if @collection.users.one?
121121
@collection.destroy
122122
redirect_to Collection, notice: t('common.notices.object_deleted', model: Collection.model_name.human)
123123
else

app/models/user.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def handle_group_memberships
121121

122122
def handle_collection_membership
123123
collections.each do |collection|
124-
collection.destroy if collection.users.count == 1
124+
collection.destroy if collection.users.one?
125125
end
126126
end
127127

app/policies/application_policy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def admin?
4141
@user.present? && @user.role == 'admin'
4242
end
4343

44-
def everyone
44+
def everyone # rubocop:disable Naming/PredicateMethod
4545
# `everyone` here means `every user logged in`
4646
@user.present?
4747
end

0 commit comments

Comments
 (0)