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
feature: add the ability to associate a registration to a user #115
Conversation
@@ -2,6 +2,7 @@ | |||
= simple_form_for([@event, @registration], validate: true) do |f| | |||
= f.input :started_at, as: :hidden, input_html: { value: @registration.started_at } | |||
= f.input :step_to_validate, as: :hidden, input_html: { value: "start" } | |||
= f.input, :user_id, as: :hidden, input_html: { value: current_user.try(: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.
@willblake01 -- this is importat. I suggest doing some reading on how try
works
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.
Will do!
@@ -9,6 +9,7 @@ class Registration < ApplicationRecord | |||
|
|||
belongs_to :event | |||
belongs_to :discount_code, counter_cache: true, optional: true | |||
belongs_to :user, optional: true |
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.
@willblake01 -- this is important. I recommend doing some googling on why the optional
param is necessary here.
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.
👍
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.
Ready to merge.
@@ -2,6 +2,7 @@ | |||
= simple_form_for([@event, @registration], validate: true) do |f| | |||
= f.input :started_at, as: :hidden, input_html: { value: @registration.started_at } | |||
= f.input :step_to_validate, as: :hidden, input_html: { value: "start" } | |||
= f.input, :user_id, as: :hidden, input_html: { value: current_user.try(: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.
Will do!
@@ -9,6 +9,7 @@ class Registration < ApplicationRecord | |||
|
|||
belongs_to :event | |||
belongs_to :discount_code, counter_cache: true, optional: true | |||
belongs_to :user, optional: true |
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.
👍
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.
Just wanted to make sure the comma in this line = f.input, :user_id, as: :hidden, input_html: { value: current_user.try(:id) }
doesn't need to be removed before merging.
Great catch! I will get that change made. |
d4f927a
to
7cf2cc4
Compare
Registrations, in this system, serve as a data container pertinent to the individual registrant. Given the importance of the fact that each individual registrant must SIGN THEIR OWN WAIVER, we can use the registration class to be the association with the individual user (member, in this parlance), in pursuit of a user profile experience.
The current registration experience DOES NOT support the creation of accounts. This PR introduces the bare minimum of the functionality needed to support that.
To test:
^ everything should work, and the user_id value should be set on your registration