ruby
ruby
ollama
Getting structured input and output from Ollama
Structured output from Ollama takes more than JSON mode. Learn the reliable pattern for a Rails app: shape the input, constrain output with JSON Schema, parse defensively, and retry with feedback so a local LLM survives production instead of just a demo.
ai
AI Agents System Architecture - Possible strategies
AI agent architecture comes down to three strategies: single agent, sequential, and parallel. When one big prompt loses the plot, how sequential chains buy reliability, where parallel agents crush latency, and the pitfalls of each before you commit.
Latest
Structured logging in Rails 8.1 with Rails.event
Structured logging lands in Rails 8.1 with the Rails.event API. How the Structured Event Reporter replaces regex-parsed log lines with JSON events, plus tags, context, schemas, debug mode, and how to subscribe and test events in your own app.
Ruby 4.0 and the magic of isolation - How Ruby::Box ends the nightmare of monkey patching
Ruby::Box in Ruby 4.0 isolates monkey patches so one gem's core-class override stops breaking the rest of your process. How the isolation works, what problems with global state it ends, and the limitations to weigh before you rely on it.
When to use Module over Class in Ruby?
Ruby modules often beat classes for service objects: why a shell class like PasswordResetInitiator is procedural code in disguise, using a module as a toolbox, mixins instead of artificial inheritance, and Data objects for tidy parameters.
Ruby 4.0 - a big update for its 30th birthday
Ruby 4.0 marks the language's 30th birthday with maturity instead of revolution: saner syntax for multiline conditions, faster boot with fewer requires, a maturing Ractor story, hidden performance gems, and protection against command injection.
Event sourcing vs GDPR, or how to forget in a world that remembers everything
Event sourcing meets GDPR the moment a user asks to be forgotten and your log is append-only. Crypto-shredding is the elegant answer: encrypt personal data per user, delete the key, and design system boundaries so backups and read models forget too.
Your system is not unique - The power of business archetypes
Business archetypes prove your 'unique' domain is usually a store selling something unusual. Map complex requirements onto universal building blocks: product catalogue, orders, entitlements, inventory for services, party and billing, and stop reinventing the wheel.
Pseudo-modularity - why your code will fall apart anyway
Pseudo-modularity looks like clean folders and rots underneath: a change in Products breaks Inventory tests and blocks three teams. Why noun-driven modules and a shared database create facade modularity, and what real module boundaries look like.
Microservices are not just technology - how not to build a distributed monolith?
A distributed monolith is what you get when microservice boundaries are drawn wrong. How to design autonomous modules in three phases: business analysis for boundaries, tight communication contracts, and deployment decisions driven by real architectural drivers.
When you should NOT use messaging, or how not to make things harder for yourself
Messaging is not a default answer. When a business flow is synchronous, queues add complexity without value and message ordering becomes your biggest pitfall. How to recognise the cases where a simple synchronous call keeps the system easier to build and debug.
How to control queues and concurrency in Sidekiq?
Sidekiq capsules let you give each queue its own concurrency, so photo processing stops clogging urgent jobs and API calls stay under rate limits. A three-step setup: configure the capsule, assign the job, and call it, with configuration examples.
Rails Performance Optimisation - Understanding GVL in practice
Rails performance starts with understanding the GVL: why only one thread runs Ruby code at a time, how that throttles CPU-bound apps, throughput vs latency, choosing a server, offloading to background jobs, and how to instrument and measure before optimising.
From microlites to microservices: How to survive in the world of event-driven systems
Event-driven systems lose, duplicate and reorder messages unless you design against it. Practical patterns for reliable delivery: the outbox pattern, change data capture straight from the database, handling order and duplicates, and how to test it all.
How to track and log slow queries in Ruby on Rails applications?
Slow SQL queries in Rails can be caught in development, before they become production fires. Using ActiveSupport::Notifications and the sql.active_record event, you build a small performance guard that logs every query above a time threshold straight to your console.
How to effectively manage and terminate old PostgreSQL connections
Idle PostgreSQL connections eat memory and can hit the max_connections limit, blocking your app. How to find old sessions in pg_stat_activity, close them safely with pg_terminate_backend, and automate the cleanup so hanging connections never pile up again.
How can the AASM state machine be replaced with built-in Ruby on Rails methods?
AASM adds complexity most Rails apps don't need. How to replace the state machine gem with Rails 7.1+ enum, validations, and small service objects: a project management example with forms, translations, unit tests, multiple enums, and state history tracking.
Deprecation in Rails: How to gracefully remove old code
Deprecation lets you remove old Rails code without breaking teammates' apps overnight. A practical look at ActiveSupport::Deprecation: why sudden deletes hurt, how to warn about methods scheduled for removal, and how to phase out code in a civilized way.
How can large files be sent efficiently in Ruby on Rails with authentication and caching?
Sending large files through Rails wastes memory and blocks app workers. X-Sendfile hands the transfer to NGINX while Rails keeps authentication and caching: server configuration, cache headers, testing in development, other HTTP servers, and a complete example.
ActiveJob::Continuable - Interrupting and resuming jobs in Ruby on Rails
ActiveJob::Continuable lets long-running Rails jobs survive restarts: split work into steps, track progress with cursors and checkpoints, and resume exactly where the job stopped. Covers error handling, queue adapter support, and a practical example.
14 powerful Rails console tricks that will supercharge your debugging
Rails console tricks that speed up debugging: silence SQL logs, reuse the last result with underscore, inspect routes and schema, find where a method is defined, run rake tasks and raw SQL, time operations, and several more you probably haven't used yet.
How to create a custom rubocop rule to improve code quality?
Custom RuboCop cops let you enforce your project's own conventions. Step by step: how cops inspect the abstract syntax tree, writing a cop that bans hardcoded phone numbers, wiring it into your RuboCop config, and watching it flag offenses in action.