diff --git a/app/controllers/admin/registrars_controller.rb b/app/controllers/admin/registrars_controller.rb index 94ca74dad..e4119e109 100644 --- a/app/controllers/admin/registrars_controller.rb +++ b/app/controllers/admin/registrars_controller.rb @@ -40,8 +40,9 @@ module Admin def edit; end def show - @result = @registrar.send(params[:records]) unless params[:records].blank? - render_by_format('admin/registrars/show', "#{@registrar.name.parameterize}_#{params[:records]}") + method = params[:records].present? ? params[:records] : 'api_users' + @result = @registrar.send(method) + render_by_format('admin/registrars/show', "#{@registrar.name.parameterize}_#{method}") end def update diff --git a/app/models/api_user.rb b/app/models/api_user.rb index 289e0e8d9..952ae09e7 100644 --- a/app/models/api_user.rb +++ b/app/models/api_user.rb @@ -100,8 +100,7 @@ class ApiUser < User active, accredited?, accreditation_expire_date, - created_at, - updated_at + created_at, updated_at, ] end diff --git a/app/models/white_ip.rb b/app/models/white_ip.rb index 358fa82c7..a90b8cdd2 100644 --- a/app/models/white_ip.rb +++ b/app/models/white_ip.rb @@ -13,6 +13,7 @@ class WhiteIp < ApplicationRecord def validate_ipv4_and_ipv6 return if ipv4.present? || ipv6.present? + errors.add(:base, I18n.t(:ipv4_or_ipv6_must_be_present)) end @@ -32,12 +33,12 @@ class WhiteIp < ApplicationRecord errors.add(:ipv6, :invalid) end - API = 'api' - REGISTRAR = 'registrar' - INTERFACES = [API, REGISTRAR] + API = 'api'.freeze + REGISTRAR = 'registrar'.freeze + INTERFACES = [API, REGISTRAR].freeze - scope :api, -> { where("interfaces @> ?::varchar[]", "{#{API}}") } - scope :registrar_area, -> { where("interfaces @> ?::varchar[]", "{#{REGISTRAR}}") } + scope :api, -> { where('interfaces @> ?::varchar[]', "{#{API}}") } + scope :registrar_area, -> { where('interfaces @> ?::varchar[]', "{#{REGISTRAR}}") } def interfaces=(interfaces) super(interfaces.reject(&:blank?)) @@ -84,7 +85,7 @@ class WhiteIp < ApplicationRecord ipv6, interfaces.join(', ').upcase, created_at, - updated_at + updated_at, ] end end