File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ] || { }
Original file line number Diff line number Diff line change 11class 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
3535end
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments