rubyforgood / rubyforgood/awbw

Decide how organization merge should handle billing (Pay gem) links

Open
#2,378 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
15
Forks
26
Avg merge
12h 42m
Merged PRs (30d)
242

Description

🤖 From Claude:

Split out from the organization deduper (#2374).

The deduper reassigns every business association from a deleted org to the kept one, reassigns analytics/audit (ahoy_events, versions), and surfaces attached files that are deleted with the record. Billing links are deliberately left out for now because moving money-related records between orgs has real side effects that need a product decision.

Affected polymorphic tables (Pay gem): pay_customers, pay_merchants, pay_subscriptions, pay_charges, pay_payment_methods, pay_webhooks (owner/polymorphic → could be an Organization).

Current behavior: these tables are in ModelDeduper::DEFERRED_REFERENCE_TABLES, so they neither block the merge nor get moved — if a merged org had billing records, they'd stay pointing at the deleted org's id.

Decide:

  • Should billing records be reassigned to the kept org on merge, left as-is, or should the merge be blocked when they exist?
  • In practice, are Pay records ever owner_type = "Organization" in this app, or only Users/People? (If never orgs, we can drop the deferral entirely.)

Once decided, update ModelDeduper (reassign / block / ignore) and remove the tables from DEFERRED_REFERENCE_TABLES as appropriate.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the organization deduper from #2374 and inspect ModelDeduper, especially DEFERRED_REFERENCE_TABLES and its handling of polymorphic Pay tables. Determine whether any listed records use owner_type="Organization" and establish whether merges should reassign, block, or ignore them. Done means the product decision is reflected in ModelDeduper and the deferred-table list.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.