Tagged

Ruby

Ruby Articles

Rack Middleware as Your First Line of Defence: Blocking Bot Scanners Before They Hit Rails

Bot scanners probing for .env files, AWS credentials, and WordPress admin panels were triggering CSRF exceptions and database queries deep in the Rails stack. A purpose-built Rack middleware intercepts these requests at the earliest possible point using extension matching, dot-directory detection, and filename prefix variants — including edge cases like dash-separated config file names that bypass naive matchers.

Designing a Two-Tier Multi-Tenant Data Model: Shared Global Records with Tenant-Scoped Overrides

How to architect a data model where shared supplier data lives in global tables (scraped once, reused by all tenants) while tenant-specific pricing and availability lives in scoped tables. Covers the 'effective delegation' pattern for transparent fallback, normalisation strategies that preserve tenant edits, and practical pitfalls with acts_as_tenant.

The Document Proxy Pattern: Coordinating File Access Across Integrated Services Without Duplicating Storage

When two applications need to share documents but users of each system lack credentials for the other, a proxy endpoint pattern emerges. This article examines the full implementation from both sides: the originating platform's webhook notification, URL-not-file storage decision, and the consuming platform's credential-scoped proxy that streams PDFs to end users.

Building Resilient Webhook Systems: A Tale of Two Directions

A deep dive into implementing bidirectional webhook infrastructure in Rails, covering HMAC signature verification, polymorphic audit logs, and the critical differences between receiving and sending webhooks. Learn how to handle webhook authentication, retry logic, and why network failures should be treated differently from HTTP errors.

The Hidden Costs of UI-First Development: A Rails Workflow Bug Postmortem

When a workflow management UI was updated to reflect a new intermediate step, but the backend routes, controller actions, model methods, and authorization policies weren't added, it created a cascade of five interrelated bugs. This postmortem examines how UI-backend misalignment creates silent failures and presents a checklist for Rails developers working on multi-layer features.

PostgreSQL DISTINCT ON Pitfalls: Silent Data Corruption from Column Name Collisions in Joins

Using PostgreSQL's DISTINCT ON with multi-table joins can silently return wrong data when both tables share a column name. This article dissects the problem and presents the two-phase subquery fix: first find matching IDs via join, then query the target table directly to avoid column ambiguity.

RoR Story-Writer with Claude

Watch this video to learn how to build a functional "short story writer" using Ruby on Rails and Claude AI. Just pass in a list of keywords and Claude will do the rest - resulting in witty short story based around your chosen words.

NLP with Claude and Ruby

In this guide we'll explore three key Natural Language Processing Task techniques: Sentiment Analysis, Named Entity Recognition, and Text Summarization, and I'll show you how to perform these techniques using Claude, Ruby, and the Anthropic API.

Basic Conversations with Claude and Ruby

Following on from the post about getting started with Claude, this article goes into detail about some of the configuration options, and provides examples how to conduct conversations with Claude using claude-ruby gem.

Getting Started with Claude and Ruby:

Why should python devs have all the fun? Learn how to integrate Claude AI assistant with Ruby. This tutorial covers obtaining an Anthropic API key, setting up Ruby and necessary gems, and using the claude-ruby gem with practical examples. Perfect for ruby developers looking to enhance their applications with AI capabilities.