From bf2c0c6bb781e886ad850696b027f0261d564712 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Thu, 9 Jul 2015 13:04:16 +0300 Subject: [PATCH] Fix rubocop #2565 --- app/controllers/admin/blocked_domains_controller.rb | 1 - app/validators/domain_name_validator.rb | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/app/controllers/admin/blocked_domains_controller.rb b/app/controllers/admin/blocked_domains_controller.rb index c890cf2b0..2df3f90d9 100644 --- a/app/controllers/admin/blocked_domains_controller.rb +++ b/app/controllers/admin/blocked_domains_controller.rb @@ -19,6 +19,5 @@ class Admin::BlockedDomainsController < AdminController flash.now[:alert] = I18n.t('failed_to_update_record') render :index end - end end diff --git a/app/validators/domain_name_validator.rb b/app/validators/domain_name_validator.rb index 325fe447a..79fec0291 100644 --- a/app/validators/domain_name_validator.rb +++ b/app/validators/domain_name_validator.rb @@ -1,17 +1,11 @@ class DomainNameValidator < ActiveModel::EachValidator - # rubocop: disable Metrics/PerceivedComplexity - # rubocop: disable Metrics/CyclomaticComplexity def validate_each(record, attribute, value) if !self.class.validate_format(value) record.errors[attribute] << (options[:message] || record.errors.generate_message(attribute, :invalid)) elsif !self.class.validate_blocked(value) record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :blocked))) - # elsif !self.class.validate_reservation(value) - # record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :reserved))) end end - # rubocop: enable Metrics/PerceivedComplexity - # rubocop: enable Metrics/CyclomaticComplexity class << self def validate_format(value) @@ -41,11 +35,5 @@ class DomainNameValidator < ActiveModel::EachValidator return true unless value BlockedDomain.where("names @> ?::varchar[]", "{#{value}}").count == 0 end - - # def validate_reservation(record, value) - # return true unless value - # return true if record.reserved_pw == record.auth_info - # !ReservedDomain.exists?(name: value.mb_chars.downcase.strip) - # end end end