sequenceDiagram
participant Controller
participant Handler
participant URLParams as URL Params<br/>(SteelWheel::Params)
participant FormParams as Form Params<br/>(EasyParams)
participant Form as ActionForm
participant BusinessLogic
Note over Controller,BusinessLogic: Initialization Phase
Controller->>Handler: Handler.handle(params)
Handler->>Handler: initialize(params)
Handler->>Handler: prepare_params(params)
Note right of Handler: Separates URL params<br/>from form params<br/>Sets @form_scope
Note over Controller,BusinessLogic: Parameter Creation (Lazy)
Controller->>Handler: handler.url_params
Handler->>URLParams: new(input)
URLParams-->>Handler: url_params instance
Note right of URLParams: Type coercion<br/>Validation ready
Controller->>Handler: handler.form_params
Handler->>FormParams: new(form_input)
FormParams-->>Handler: form_params instance
Note right of FormParams: Type coercion<br/>Validation ready
Note over Controller,BusinessLogic: Validation Phase
Handler->>Handler: validate_preconditions()
alt URL Params Invalid
Handler->>URLParams: invalid?
URLParams-->>Handler: true (errors present)
Handler->>Handler: failure_params()
Handler->>Handler: http_status = :bad_request
Handler->>Handler: errors.merge!(url_params.errors)
Handler->>Handler: failure_callback()
Note right of Handler: Stop execution
else Form Params Invalid
Handler->>FormParams: invalid?
FormParams-->>Handler: true (errors present)
Handler->>Handler: failure_form()
Handler->>Handler: http_status = :unprocessable_entity
Handler->>FormParams: create_form(owner, method, action)
FormParams->>Form: new(owner, params, errors)
Form-->>Handler: form with errors
Handler->>Handler: @form = form
Handler->>Handler: failure_callback()
Note right of Handler: Stop execution
else Handler Validation Invalid
Handler->>Handler: invalid? (ActiveModel validations)
Handler-->>Handler: true (errors present)
Handler->>Handler: failure_self()
Handler->>Handler: http_status = status
Handler->>Handler: errors.delete(@form_scope)
Handler->>Handler: failure_callback()
Note right of Handler: Stop execution
end
Note over Controller,BusinessLogic: Execution Phase (if validation passes)
Handler->>Handler: success? == true
Handler->>Handler: on_validation_success()
Handler->>BusinessLogic: call()
BusinessLogic-->>Handler: result
Note over Controller,BusinessLogic: Form Creation (if needed)
alt Form Requested (GET/new/edit)
Controller->>Handler: handler.form
Handler->>Handler: form_attributes
Handler->>Form: new(owner, **form_attributes)
Form-->>Handler: form instance
else Form Requested (POST/PATCH with errors)
Controller->>Handler: handler.form
Handler->>FormParams: create_form(owner, method, action)
FormParams->>Form: new(owner, params, errors)
Form-->>Handler: form with errors
end
Note over Controller,BusinessLogic: Callback Phase
alt Success
Handler->>Handler: errors.empty?
Handler->>Handler: success_callback()
Handler->>Controller: Execute success block
else Failure
Handler->>Handler: failure_callback()
Handler->>Controller: Execute failure block (by status)
end
Last active
December 31, 2025 07:33
-
-
Save andriy-baran/8c2ec517397ffdf7fa77a006485f172b to your computer and use it in GitHub Desktop.
SteelWheel sequence diagram
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment