Skip to content

Allow comment deletion via nested attributes#1358

Open
maebeale wants to merge 1 commit intomainfrom
maebeale/comment-delete-ahoy-log
Open

Allow comment deletion via nested attributes#1358
maebeale wants to merge 1 commit intomainfrom
maebeale/comment-delete-ahoy-log

Conversation

@maebeale
Copy link
Collaborator

@maebeale maebeale commented Mar 7, 2026

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

  • Comments on Person, User, Organization, and EventRegistration records could not be deleted
  • Adds the ability to remove comments from the nested form on edit pages

How did you approach the change?

  • Added allow_destroy: true to accepts_nested_attributes_for :comments on all 4 commentable models
  • Permitted :_destroy in comments_attributes strong params in People, Users, and Organizations controllers (EventRegistrations already had it)
  • Added a cocoon "Remove" link to the _comment_fields.html.erb partial, matching the style used for affiliations

UI Testing Checklist

  • Edit a person and verify "Remove" link appears on existing comments
  • Click "Remove" on a comment, save the form, and verify the comment is deleted
  • Verify the same works on user, organization, and event registration edit pages

🤖 Generated with Claude Code

Enable allow_destroy on accepts_nested_attributes_for :comments
across all commentable models (Person, User, Organization,
EventRegistration) and permit :_destroy in their controllers.
Adds a "Remove" link to the comment fields partial.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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