Fix all rubocop warnings
This commit is contained in:
parent
05e39dc619
commit
bf851133ae
48 changed files with 124 additions and 97 deletions
|
@ -63,7 +63,7 @@ class DomainBlock < ApplicationRecord
|
|||
|
||||
uri = Addressable::URI.new.tap { |u| u.host = domain.strip.gsub(/[\/]/, '') }
|
||||
segments = uri.normalized_host.split('.')
|
||||
variants = segments.map.with_index { |_, i| segments[i..-1].join('.') }
|
||||
variants = segments.map.with_index { |_, i| segments[i..].join('.') }
|
||||
|
||||
where(domain: variants).order(Arel.sql('char_length(domain) desc')).first
|
||||
rescue Addressable::URI::InvalidURIError, IDN::Idna::IdnaError
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue