/ tag
Rails
12 posts on this topic.
-
gRPC vs REST: when I actually reach for each (and when gRPC is a mistake)
gRPC vs REST gets argued in the abstract. I've shipped both — a Rails↔Go deploy engine on gRPC, browser uploads on plain WebSockets. Here's my actual rule for choosing, and the cases where gRPC is the wrong call.
-
Streaming a deploy from a Go agent to Rails over gRPC
One-click deploy means running git clone, docker build and docker run on a remote box and showing every log line live. How I stream that: a Go agent that pipes each command's output over a gRPC server-stream to a Rails control plane, which turns it into a live deploy log.
-
Syncing invoices to QuickBooks when the other side keeps changing under you
Third-party accounting APIs don't fail cleanly. Customers get deleted in QuickBooks behind your back, tokens expire mid-request, and retries duplicate records. Here's how one Rails integration stayed idempotent and learned to heal itself.
-
The Postgres features I reach for before I reach for a cache
A slow multi-tenant Rails app usually isn't slow because Postgres is slow. It's slow because the work is being done in Ruby that Postgres would do better. DISTINCT ON, array overlap, and full-text search — with the honest limits.
-
Roles that contain roles: an RBAC resolved by a recursive Postgres query
When a role can inherit other roles, permissions stop being a list and become a graph — and graphs are where the ORM taps out. Here's a role system resolved in one WITH RECURSIVE query, cached per tenant, and enforced through method_missing.
-
Schema-per-tenant Rails, and the bug that only shows up in a background job
Isolating tenants in separate Postgres schemas is the easy 90%. The 10% that bites is keeping that isolation when work leaves the web request and runs on an SQS worker. Here's how we carried the tenant across the queue.
-
Wiring up an open-banking feed in Rails without leaking or getting locked in
Bank aggregators are slow, asynchronous, and full of PII you must never log. Here's how I integrated one: a swappable provider, encrypted credentials, a recursively-redacting request logger, and a poll-until-done connection job.
-
Auto-categorizing bank transactions with Postgres fuzzy matching (no ML)
'UBER *EATS 8829' and 'UBER* EATS' are the same recurring expense, but the strings don't match. How I auto-categorize bank feeds with Postgres levenshtein() and soundex() against a user's own history — no machine learning.
-
Charging a card once in Rails: the guard I shipped, and the gaps I didn't close
A payments flow is 'at least once' at every layer — retries, double-clicks, replayed webhooks. Here's the guard that stops the common cases, an honest accounting of the ones it doesn't, and how I'd close them.
-
Building an invoice tax engine in Rails that accountants trust
Tax-inclusive and tax-exclusive pricing round differently, and one cent of drift makes an invoice look broken. How I built a tax engine with the Strategy pattern, BigDecimal, and spreadsheet-verified golden-master tests.
-
Splitting money in a marketplace: Stripe Connect, destination charges, and getting hosts paid
A marketplace can't just charge a card — the money has to split between the platform and the host, and the host has to be onboarded for payouts. The real Stripe Connect wiring: Express accounts, hosted onboarding, and a destination charge that skims the platform fee.
-
The availability search that loaded every booking into memory — a Rails date-range fix
A marketplace 'search by dates' feature quietly became O(bookings × listings): it pulled every booking in the database into Ruby and eliminated listings one query at a time. The fix was a single overlap query the codebase already had — and never used.