Skip to content

Rename public_registration to public_forms with variant-aware routing#1599

Open
maebeale wants to merge 2 commits into
mainfrom
maebeale/scholarship-registration-url-params
Open

Rename public_registration to public_forms with variant-aware routing#1599
maebeale wants to merge 2 commits into
mainfrom
maebeale/scholarship-registration-url-params

Conversation

@maebeale

@maebeale maebeale commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

What is the goal of this PR and why is this important?

  • The single public_registration resource conflated three distinct public-facing flows: registration, scholarship application, and bulk payment
  • Each flow now gets its own explicit URL (registration_form, scholarship_form, bulk_payment_form) instead of being inferred from query params alone, making the variant visible in the URL and shareable

How did you approach the change?

  • Renamed Events::PublicRegistrationsControllerEvents::PublicFormsController and the matching policy/views/specs
  • Replaced the lone public_registration route with three singular resources that share the public_forms controller, each passing a form_variant default (registration/scholarship/bulk_payment)
  • form_variant drives the page heading, the new/submit path helpers, and scholarship mode, so one controller serves all three flows
  • Updated all render/link_to references from events/public_registrations/* to events/public_forms/*
  • Added spec/routing/public_forms_routing_spec.rb covering each variant's new/create/show routes and confirming no collision with the registrant registrations route

Anything else to add?

  • Pure rename + routing refactor; no behavior change to the form flows themselves
  • Verified: ai/lint clean, routing + registrations + scholarships request specs green (56 examples, 0 failures)

🤖 Generated with Claude Code

The single public_registration resource conflated three distinct
public-facing flows (registration, scholarship application, bulk
payment). Splitting it into registration_form/scholarship_form/
bulk_payment_form resources that share one PublicFormsController lets
each flow have its own URL while a form_variant default drives the
heading, paths, and scholarship behavior — making the variant explicit
in the URL instead of inferred from query params alone.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@maebeale maebeale marked this pull request as ready for review June 8, 2026 15:31

def form_variant
VARIANTS.include?(params[:form_variant]) ? params[:form_variant] : "registration"
end

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: form_variant is whitelisted against VARIANTS and falls back to "registration", so an unknown variant in the URL degrades to the default flow rather than blowing up the path helpers below.

params[:scholarship_requested] != "false"
else
params[:scholarship_requested] == "true"
end

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: Scholarship default differs by variant: the scholarship_form flow opts in unless scholarship_requested=false, while other flows opt in only when explicitly =true. This preserves the existing query-param behavior for the registration flow.

Comment thread config/routes.rb
@@ -130,7 +130,15 @@
post :send_reminder
end
resource :registrations, only: %i[ create destroy ], module: :events, as: :registrant_registration

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: The registrant_registration resource stays separate from the three new public *_form resources — the routing spec asserts POST /events/:id/registrations still hits events/registrations#create and does not collide.

Add bulk_payment and ce_credit as event-form roles and drive the public
form endpoints, controller variant whitelist, and Event#*_form accessors
off EventForm::ROLES so the role list lives in exactly one place. Routes
and per-role scopes/accessors are now generated from ROLES, and the
controller's "form_variant" concept is renamed to "form_role" to match
the model's vocabulary. No behavior change to the existing registration
and scholarship flows.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant