-
Notifications
You must be signed in to change notification settings - Fork 7
Add event registration via turbo #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add user_id to event registration Remove email and name
ae64b97 to
81d4f7f
Compare
81d4f7f to
13b6f29
Compare
| flash[:alert] = "Unable to find that registration." | ||
| end | ||
| end | ||
| # def bulk_create |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
app/models/event.rb
Outdated
| has_many :bookmarks, as: :bookmarkable, dependent: :destroy | ||
| has_many :event_registrations, dependent: :destroy | ||
|
|
||
| has_many :users, through: :event_registrations |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
app/models/event_registration.rb
Outdated
| @@ -1,7 +1,6 @@ | |||
| class EventRegistration < ApplicationRecord | |||
| belongs_to :user | |||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty
maebeale
left a comment
There was a problem hiding this 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!
maebeale
left a comment
There was a problem hiding this 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.
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_registrationsand changes to useuserallowing 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