Skip to content

Comments

Add comments to EventRegistration form#1115

Merged
maebeale merged 3 commits intomainfrom
maebeale/event-reg-comments
Feb 20, 2026
Merged

Add comments to EventRegistration form#1115
maebeale merged 3 commits intomainfrom
maebeale/event-reg-comments

Conversation

@maebeale
Copy link
Collaborator

Set up polymorphic comments on EventRegistration following the same pattern used by Person, User, and Organization.

  • This work Closes [link an issue]

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

  • Allow admins to added comments on event_registration object

How did you approach the change?

Anything else to add?

maebeale and others added 3 commits February 20, 2026 08:06
Set up polymorphic comments on EventRegistration following the same
pattern used by Person, User, and Organization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- EventRegistrationsController#update: use assign_attributes + save
  pattern to set created_by/updated_by on comments (matching people,
  users, organizations controllers)
- EventRegistrationsController: eager-load comments with created_by
  and updated_by associations
- CommentsController#create: set created_by on standalone comment
  creation for all commentable models
- Comment fields partial: update color palette and fallback to
  "Unknown" for comments without created_by

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Explicitly set both created_by and updated_by when creating new
comments, whether via CommentsController#create or nested attributes
in all four commentable controllers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
authorize!
@comment = @commentable.comments.build(comment_params)
@comment.created_by = current_user
@comment.updated_by = current_user
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

making these explicitly saved

authorize! @organization
@organization.assign_attributes(organization_params)
@organization.comments.select(&:new_record?).each { |c| c.created_by = current_user }
@organization.comments.select(&:new_record?).each { |c| c.created_by = current_user; c.updated_by = current_user }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

adding updated_by on create


@person.assign_attributes(person_params)
@person.comments.select(&:new_record?).each { |c| c.created_by = current_user }
@person.comments.select(&:new_record?).each { |c| c.created_by = current_user; c.updated_by = current_user }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

adding updated_by on create

@user.assign_attributes(user_params.except(:password, :password_confirmation))
@user.updated_by = current_user
@user.comments.select(&:new_record?).each { |c| c.created_by = current_user }
@user.comments.select(&:new_record?).each { |c| c.created_by = current_user; c.updated_by = current_user }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

adding updated_by on create

["bg-yellow-200", "text-yellow-800"],
["bg-red-100", "text-red-800"]
["bg-blue-100", "text-blue-800"],
["bg-green-100", "text-green-800"],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changing which colors get used to show updated by initials

@maebeale maebeale merged commit 215965f into main Feb 20, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/event-reg-comments branch February 20, 2026 14:42
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