mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 21:16:12 +02:00
Fixed codeclimate issues
This commit is contained in:
parent
0f16ec77f5
commit
dc41cfb103
3 changed files with 11 additions and 10 deletions
|
@ -40,8 +40,9 @@ module Admin
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@result = @registrar.send(params[:records]) unless params[:records].blank?
|
method = params[:records].present? ? params[:records] : 'api_users'
|
||||||
render_by_format('admin/registrars/show', "#{@registrar.name.parameterize}_#{params[:records]}")
|
@result = @registrar.send(method)
|
||||||
|
render_by_format('admin/registrars/show', "#{@registrar.name.parameterize}_#{method}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
@ -100,8 +100,7 @@ class ApiUser < User
|
||||||
active,
|
active,
|
||||||
accredited?,
|
accredited?,
|
||||||
accreditation_expire_date,
|
accreditation_expire_date,
|
||||||
created_at,
|
created_at, updated_at,
|
||||||
updated_at
|
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ class WhiteIp < ApplicationRecord
|
||||||
|
|
||||||
def validate_ipv4_and_ipv6
|
def validate_ipv4_and_ipv6
|
||||||
return if ipv4.present? || ipv6.present?
|
return if ipv4.present? || ipv6.present?
|
||||||
|
|
||||||
errors.add(:base, I18n.t(:ipv4_or_ipv6_must_be_present))
|
errors.add(:base, I18n.t(:ipv4_or_ipv6_must_be_present))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -32,12 +33,12 @@ class WhiteIp < ApplicationRecord
|
||||||
errors.add(:ipv6, :invalid)
|
errors.add(:ipv6, :invalid)
|
||||||
end
|
end
|
||||||
|
|
||||||
API = 'api'
|
API = 'api'.freeze
|
||||||
REGISTRAR = 'registrar'
|
REGISTRAR = 'registrar'.freeze
|
||||||
INTERFACES = [API, REGISTRAR]
|
INTERFACES = [API, REGISTRAR].freeze
|
||||||
|
|
||||||
scope :api, -> { where("interfaces @> ?::varchar[]", "{#{API}}") }
|
scope :api, -> { where('interfaces @> ?::varchar[]', "{#{API}}") }
|
||||||
scope :registrar_area, -> { where("interfaces @> ?::varchar[]", "{#{REGISTRAR}}") }
|
scope :registrar_area, -> { where('interfaces @> ?::varchar[]', "{#{REGISTRAR}}") }
|
||||||
|
|
||||||
def interfaces=(interfaces)
|
def interfaces=(interfaces)
|
||||||
super(interfaces.reject(&:blank?))
|
super(interfaces.reject(&:blank?))
|
||||||
|
@ -84,7 +85,7 @@ class WhiteIp < ApplicationRecord
|
||||||
ipv6,
|
ipv6,
|
||||||
interfaces.join(', ').upcase,
|
interfaces.join(', ').upcase,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at,
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue