Skip to content

Feature: automatic item dup - #138

Merged
sfnelson merged 3 commits into
mainfrom
feature/automatic-item-dup
Aug 19, 2026
Merged

Feature: automatic item dup#138
sfnelson merged 3 commits into
mainfrom
feature/automatic-item-dup

Conversation

@sfnelson

Copy link
Copy Markdown
Contributor

Provides dup support for item associations:

  • ActiveStorage attachments defined with has_*_attached
  • ActionText attachments defined with has_rich_text
  • Custom associations declared with duplicates_association
    Items no longer need to define initialize_dup unless they have
    custom associations. rubocop-katalyst has related cop to check that
    owned associations call duplicates_association.

Previously, item implementors were expected to handle copy/dup
for custom items. With the addition of govuk_attachment_field we
broke support for optional attachments, so rather than fix once here
and expect consumers to mimic the fix, we're using ActiveStorage
reflection to handle duplication automatically. This should help
simplify custom items.
Provides dup support for item associations:
- ActiveStorage attachments defined with has_*_attached
- ActionText attachments defined with has_rich_text
- Custom associations declared with `duplicates_association`
Items no longer need to define `initialize_dup` unless they have
custom associations. `rubocop-katalyst` has related cop to check that
owned associations call `duplicates_association`.
@sfnelson
sfnelson merged commit c3b764d into main Aug 19, 2026
1 check passed
@sfnelson
sfnelson deleted the feature/automatic-item-dup branch August 19, 2026 01:59
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.

2 participants