Blog
Notes and deep dives on Ruby on Rails, PostgreSQL, React and building maintainable web applications.
9 min read
Organizing Rails Models in Folders with Custom Table Names
As Rails applications grow in complexity, organizing models into logical folders becomes essential for maintainability and code organization. This comprehensive guide explores how to structure models in folders while configuring table names to reflect the folder hierarchy, creating a clean and scalable architecture.
Ruby on RailsArchitecture
7 min read
Scaling Rails Applications with Multiple Databases: A Complete Guide
As Rails applications grow in complexity and scale, managing all your data in a single database can become a bottleneck. Whether you're dealing with massive datasets, need to separate read and write operations, or want to isolate different business domains, Rails' multiple database support provides elegant solutions to these challenges.
Ruby on RailsPostgreSQLScaling
10 min read
Multiple Table Inheritance Patterns in Ruby on Rails with PostgreSQL
Multiple Table Inheritance (MTI) is a database design pattern where related classes are stored across multiple tables, with each subclass having its own table that references a common base table. This approach provides better data normalization and type safety compared to Single Table Inheritance (STI) but comes with increased complexity.
Ruby on RailsPostgreSQLDesign Patterns
6 min read
Single Table Inheritance in Ruby on Rails with PostgreSQL
Single Table Inheritance (STI) is a powerful design pattern in Ruby on Rails that allows you to store different types of related models in a single database table. This approach is particularly useful when you have a hierarchy of classes that share common attributes but have different behaviors.
Ruby on RailsPostgreSQLDesign Patterns
7 min read
Service Objects in Rails: Where Business Logic Actually Belongs
Fat models and fat controllers are both symptoms of the same missing layer. This is a practical look at when to extract a service object, how to design one that stays testable, and the patterns that turn into a second mess.
Ruby on RailsArchitectureDesign Patterns
7 min read
Keeping an RSpec Suite Fast and Trustworthy
A slow, flaky test suite gets ignored, and an ignored suite protects nothing. These are the practices that keep RSpec fast and deterministic as a Rails codebase grows: honest factories, the right level of test, and removing shared state.
Ruby on RailsTestingRSpec
7 min read
PostgreSQL Indexing: A Practical Guide for Rails Developers
Most Rails applications are under-indexed in the places that matter and over-indexed everywhere else. This is a working guide to choosing the right index, reading a query plan, and adding indexes without locking your tables.
PostgreSQLRuby on RailsPerformance
7 min read
Finding and Fixing N+1 Queries in Rails for Good
N+1 queries are the most common performance problem in Rails applications. This guide covers how to detect them reliably, the difference between the eager loading strategies, and the cases where preloading quietly stops working.
Ruby on RailsPerformancePostgreSQL