Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
Refactor registration_controller.rb (#250)
Browse files Browse the repository at this point in the history
Several refactors to simplify and consolidate logic in registration controller, as well as related tests and model
  • Loading branch information
dunkOnIT authored Oct 11, 2023
1 parent c0abc91 commit 9d58250
Show file tree
Hide file tree
Showing 20 changed files with 353 additions and 469 deletions.
6 changes: 5 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ AllCops:
Bundler/OrderedGems:
Enabled: false

Lint/MissingSuper:
Exclude:
- 'lib/registration_error.rb'

Lint/EmptyWhen:
Enabled: false

Expand Down Expand Up @@ -224,4 +228,4 @@ Style/HashSyntax:
Style/GlobalVars:
AllowedVariables:
- $sqs
- $dynamodb
- $dynamodb
8 changes: 6 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ def performance_profile(&)
end
end

def render_error(status, error)
def render_error(http_status, error)
Metrics.registration_validation_errors_counter.increment
render json: { error: error }, status: status
render json: { error: error }, status: http_status
end

rescue_from ActionController::ParameterMissing do |e|
render json: { error: ErrorCodes::INVALID_REQUEST_DATA }, status: :bad_request
end
end
Loading

0 comments on commit 9d58250

Please sign in to comment.