Skip to content

Commit 99b7790

Browse files
committed
Fix Rubocop offenses
1 parent fd447af commit 99b7790

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

app/controllers/labels_controller.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ def update
1515
end
1616
end
1717

18-
def destroy
19-
@label.destroy
20-
end
18+
delegate :destroy, to: :@label
2119

2220
def merge # rubocop:disable Metrics/AbcSize
2321
label_ids = params[:label_ids] || []

app/policies/task_contribution_policy.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# frozen_string_literal: true
22

33
class TaskContributionPolicy < ApplicationPolicy
4+
delegate :base, :suggestion, to: :@record
5+
46
def initialize(user, record)
57
super
68
@record = record.task_contribution if record.is_a?(Task)
@@ -10,14 +12,6 @@ def task_contribution
1012
@record
1113
end
1214

13-
def suggestion
14-
@record.suggestion
15-
end
16-
17-
def base
18-
@record.base
19-
end
20-
2115
%i[create? new?].each do |action|
2216
define_method(action) do
2317
Pundit.policy(@user, base).contribute?

0 commit comments

Comments
 (0)