Fix some CC issues

This commit is contained in:
Karl Erik Õunapuu 2020-08-12 12:31:11 +03:00
parent a703c312a0
commit b7f03dfa69
3 changed files with 31 additions and 13 deletions

View file

@ -23,11 +23,12 @@ class SettingEntry < ApplicationRecord
SettingEntry.order(id: :asc).where(group: group_name)
end
# rubocop:disable Style/MethodMissingSuper
def self.method_missing(method, *args)
super(method, *args)
rescue NoMethodError
if method.to_s[-1] == "="
stg_code = method.to_s.sub("=", "")
if method.to_s[-1] == '='
stg_code = method.to_s.sub('=', '')
stg_value = args[0].to_s
SettingEntry.find_by!(code: stg_code).update(value: stg_value)
else
@ -35,6 +36,7 @@ class SettingEntry < ApplicationRecord
stg ? stg.retrieve : nil
end
end
# rubocop:enable Style/MethodMissingSuper
# Validators
def valid_value_format