Skip to content

Replace Kits with KitItems#5597

Open
dorner wants to merge 2 commits into
mainfrom
kits-to-kit-items
Open

Replace Kits with KitItems#5597
dorner wants to merge 2 commits into
mainfrom
kits-to-kit-items

Conversation

@dorner

@dorner dorner commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

This is the semifinal step in the move to finally get rid of kits - in fact, that's what this PR does! The only thing left is a table and a column.

Previous PRs moved from a Kit having an item that had line items, to moving the line items directly to that item (now called a KitItem and part of an STI table).

This PR removes Kits entirely and changes all calling code to only look at the KitItems.

A couple of oddities:

  • The routes and UI still show "kits", not "kit_items", in the interests of keeping the language sane.
  • Events have had to be updated to point from the original kit to the kit item.
  • The majority of the changes are simplifications, removing joins and introducing some polymorphic goodness by having KitItem just override a couple methods instead of copying everything from Kit (the whole idea was that Kit and Item shared a lot of the same functionality).

Did some ad-hoc local testing and looks OK. Code was mostly generated by Claude and reviewed by me. Will definitely need some in-depth manual testing.

@dorner dorner requested a review from awwaiid June 12, 2026 20:52
@storage_locations = current_organization.storage_locations.active
@items = current_organization.items.loose.active.alphabetized
@items = ConcreteItem.where(organization: current_organization).active.alphabetized
end

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add current_organization.concrete_items


def index
@kits = current_organization.kits.includes(kit_item: {line_items: :item}).class_filter(filter_params)
@kits = current_organization.kit_items.includes(line_items: :item).class_filter(filter_params)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Note to self: consider renaming kit_items to kits, and therefore these diffs will look different and the semantics are lifted to the rename

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