Skip to content
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

Merged
merged 1 commit into from Dec 16, 2019

Conversation

ColinW520
Copy link
Collaborator

@ColinW520 ColinW520 commented Dec 16, 2019

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:

  • Pull down this branch
  • Run migrations
  • Sign in as an admin
  • Register for an available race

^ everything should work, and the user_id value should be set on your registration

@ColinW520 ColinW520 self-assigned this Dec 16, 2019
@@ -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) }
Copy link
Collaborator Author

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

Copy link
Collaborator

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
Copy link
Collaborator Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@willblake01 willblake01 left a comment

Choose a reason for hiding this comment

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

Ready to merge.

app/views/registrations/_form.html.haml Outdated Show resolved Hide resolved
@@ -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) }
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@willblake01 willblake01 left a 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.

@ColinW520
Copy link
Collaborator Author

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.

@ColinW520 ColinW520 force-pushed the feature/associate-users-to-registrations branch from d4f927a to 7cf2cc4 Compare December 16, 2019 22:02
@ColinW520 ColinW520 merged commit 76ca258 into master Dec 16, 2019
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.

None yet

2 participants