Fixed codeclimate issues

This commit is contained in:
Sergei Tsoganov 2023-05-15 14:30:18 +03:00
parent dc41cfb103
commit f721bc50a3
2 changed files with 10 additions and 4 deletions

View file

@ -40,9 +40,10 @@ module Admin
def edit; end
def show
method = params[:records].present? ? params[:records] : 'api_users'
@result = @registrar.send(method)
render_by_format('admin/registrars/show', "#{@registrar.name.parameterize}_#{method}")
method = allowed_method(params[:records]) || 'api_users'
@result = @registrar.send(method.to_sym)
partial_name = "#{@registrar.name.parameterize}_#{method}"
render_by_format('admin/registrars/show', partial_name)
end
def update
@ -176,5 +177,10 @@ module Admin
def iban_max_length
Iban.max_length
end
def allowed_method(records_param)
allowed_methods = %w[api_users white_ips]
records_param if allowed_methods.include?(records_param)
end
end
end

View file

@ -100,7 +100,7 @@ class ApiUser < User
active,
accredited?,
accreditation_expire_date,
created_at, updated_at,
created_at, updated_at
]
end