Skip to content

Conversation

@jmilljr24
Copy link
Collaborator

@jmilljr24 jmilljr24 commented Nov 10, 2025

Resolves #320

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

Change event registration to a single button click for authenticated users. Partial page updates via turbo to reflect the new registration.

How did you approach the change?

This removes the email and name attributes from event_registrations and changes to use user allowing the model to be a through table for user and events.

On the frontend, a user can click register and the card is updated via turbo.

Anything else to add?

Non-user registration will need to be added in the future via an inactive attribute.

Screencast.from.2025-11-10.13-17-04.webm

@jmilljr24 jmilljr24 force-pushed the add_event_registration_via_turbo branch from ae64b97 to 81d4f7f Compare November 10, 2025 21:03
@jmilljr24 jmilljr24 force-pushed the add_event_registration_via_turbo branch from 81d4f7f to 13b6f29 Compare November 10, 2025 21:07
@jmilljr24 jmilljr24 marked this pull request as ready for review November 10, 2025 21:10
@jmilljr24 jmilljr24 requested a review from maebeale November 10, 2025 21:24
flash[:alert] = "Unable to find that registration."
end
end
# def bulk_create
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think we can delete this entirely, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wasn't sure how quickly we would get to adding the non-user reg and thought it might still be useful for that. But probably better to remove this, keep the code clean and add what we need, when we need it.


private

def event_registration_params
Copy link
Collaborator

Choose a reason for hiding this comment

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

we're removing strong params entirely?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In this case we don't need it as there is no mass assignment. I'm using the param event_id to grab the event.

has_many :bookmarks, as: :bookmarkable, dependent: :destroy
has_many :event_registrations, dependent: :destroy

has_many :users, through: :event_registrations
Copy link
Collaborator

Choose a reason for hiding this comment

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

may we make this has_many :registrants, through: :event_registrations, class_name: "User" just so it's a little clearer?

Copy link
Collaborator

Choose a reason for hiding this comment

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

changes look great. thank you!

@@ -1,7 +1,6 @@
class EventRegistration < ApplicationRecord
belongs_to :user
Copy link
Collaborator

Choose a reason for hiding this comment

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

similar here, and maybe make this something like: belongs_to :registrant, class_name: "User", foreign_key: :registrant_id

Copy link
Collaborator

Choose a reason for hiding this comment

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

ty

Copy link
Collaborator

@maebeale maebeale left a comment

Choose a reason for hiding this comment

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

looks amazing, @jmilljr24 ! great work!!!

my only suggestion was to go with aliased associations between User and EventRegistrations (using registrant in favor of user), but it's not required. it's fine as is!

@jmilljr24 jmilljr24 requested a review from maebeale November 13, 2025 13:57
Copy link
Collaborator

@maebeale maebeale left a comment

Choose a reason for hiding this comment

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

perfect! thanks for making those changes.

@jmilljr24 jmilljr24 merged commit 8e5e5f9 into main Nov 13, 2025
2 checks passed
@jmilljr24 jmilljr24 deleted the add_event_registration_via_turbo branch November 13, 2025 21:30
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.

Add Event Registration via Turbo

3 participants