Skip to content

Commit 6124c9d

Browse files
committed
PC-50: fixed lint code
1 parent 7959806 commit 6124c9d

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

app/admin/items.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def update
194194
private
195195

196196
def apply_tmp_params(item, tmp)
197-
return unless tmp.present?
197+
return if tmp.blank?
198198

199199
data = tmp.deep_symbolize_keys
200200
item.fixed_parameters = data[:fixed] || {}

app/models/category.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class Category < ApplicationRecord
22
ASCII_CHARACTERS = /\A[[:ascii:]]*\z/
3-
4-
has_many :items
5-
3+
4+
has_many :items, dependent: :nullify
5+
66
normalizes :name, with: ->(name) { name.gsub(/\s+/, ' ').strip }
77

88
after_update :disable_related_items_if_disabled
@@ -30,6 +30,6 @@ def self.ransackable_associations(_auth_object = nil)
3030
def disable_related_items_if_disabled
3131
return unless saved_change_to_is_disabled? && is_disabled?
3232

33-
items.update_all(is_disabled: true)
33+
items.update_all(is_disabled: true) # rubocop:disable Rails/SkipsModelValidations
3434
end
3535
end

app/services/item_updater.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def call
1313
reset_all_fields(pricing)
1414
update_by_pricing_type(pricing)
1515
persist!(pricing)
16-
rescue ActiveRecord::RecordInvalid => e
16+
rescue ActiveRecord::RecordInvalid
1717
false
1818
end
1919

@@ -60,12 +60,12 @@ def update_fixed(pricing)
6060
def update_open(pricing)
6161
labels_string = params.dig("item_pricing_attributes", "open_parameters_label_as_string")
6262
labels = labels_string.to_s.split(',').map(&:strip).reject(&:blank?)
63-
63+
6464
pricing.open_parameters_label = labels
6565
pricing.is_open = labels.any?
6666
end
6767

68-
def update_fixed_open(pricing)
68+
def update_fixed_open(pricing) # rubocop:disable Metrics/AbcSize
6969
return unless session_data
7070

7171
data = session_data.deep_symbolize_keys

0 commit comments

Comments
 (0)