Syed Aslam
banner
syedaslam.com
Syed Aslam
@syedaslam.com
Designing software systems and thinking about why most of them hurt.
Rails, JavaScript, architecture, product.

https://syedaslam.com
https://railsrevelry.substack.com
Passing a model to perform_later preserves an identifier, not its current attributes. Two jobs for two status changes can both reload the same latest row. discard_on DeserializationError can also drop transient DB failures. The safer policy:

railsrevelry.substack.com/p/active-job...
A Record Passed to Active Job Becomes an Identifier, Not a Snapshot
Two subscription updates enqueue two webhook jobs. Both later load the same past_due row, so the receiver never sees active. Trace the GlobalID payload, the worker lookup, and the exception policy tha...
railsrevelry.substack.com
September 15, 2026 at 2:04 PM
Rails can log a job as enqueued while perform never starts. It may be ready on crm_sync while every worker polls default. I trace the job ID through adapter handoff, backend state, worker start, and the final side effect: railsrevelry.substack.com/p/what-actua...
What Actually Happens When You Call perform_later
Rails logged SyncCustomerJob as enqueued. The job is ready, the CRM record is unchanged, and retrying won't help. Trace what perform_later guarantees and what still belongs to the queue and the worker...
railsrevelry.substack.com
September 7, 2026 at 7:02 PM
Learn when Rails after_commit runs, why jobs can miss newly saved rows, how nested transactions affect callbacks, and where delivery can still fail.

railsrevelry.substack.com/p/when-shoul...
When Should You Use after_commit in Rails?
Why a job can receive a record ID before another database connection can see the row.
railsrevelry.substack.com
August 16, 2026 at 7:11 AM
save returning false is a local Active Record outcome.

If that save joined an outer transaction, earlier database work can still commit when the outer block finishes normally.

First ask how far the save got. Then ask whether the transaction still commits.

railsrevelry.substack.com/p/what-happe...
What Happens When You Call save
An account has a pending change, save returns false, errors stays empty, and no UPDATE reaches the database. This article traces the Active Record lifecycle that refused the write, shows how callbacks...
railsrevelry.substack.com
August 2, 2026 at 4:15 AM
What stale reads, concurrent writes, association caches, and Rails' abandoned Identity Map reveal about live Active Record objects.

syedaslam.com/posts/why-ac...
Why Active Record's Snapshot Semantics Are a Trade-off, Not a Missing Feature | Syed Aslam
What stale reads, concurrent writes, association caches, and Rails' abandoned Identity Map reveal about live Active Record objects.
syedaslam.com
July 28, 2026 at 4:21 PM
Rails can corrupt an audit transition without raising.

One object saves twice:
trial -> starter
starter -> growth

before_update reads plan_before_last_save as trial.

Dirty tracking only makes sense when you name both sides of the comparison.

railsrevelry.substack.com/p/how-rails-...
How Rails knows what changed
Why the same callback can read the right value at the wrong point in an Active Record object's lifecycle.
railsrevelry.substack.com
July 26, 2026 at 5:45 AM
Learn how Git worktrees keep multiple branches checked out in separate directories, reducing stashing and branch switching during reviews, hotfixes, rebases, and stacked pull requests.

syedaslam.com/posts/git-wo...
Git Worktrees: Multiple Branches Without the Checkout Shuffle | Syed Aslam
Learn how Git worktrees keep multiple branches checked out in separate directories, reducing stashing and branch switching during reviews, hotfixes, rebases, and stacked pull requests.
syedaslam.com
July 23, 2026 at 8:43 AM
Reposted by Syed Aslam
Rails association methods that look interchangeable:

account.invoices.count # SQL count, every call
account.invoices.size # loaded target, counter cache
account.invoices.any? # depends on loaded state

Preloading makes some collection reads memory-backed.

railsrevelry.substack.com/p/where-does...
Why N+1 Queries Are a Natural Result of Lazy Loading
Why loading the parents doesn't load their associations — and why preloading doesn't fix every repeated query.
open.substack.com
July 19, 2026 at 6:40 AM
Rails association methods that look interchangeable:

account.invoices.count # SQL count, every call
account.invoices.size # loaded target, counter cache
account.invoices.any? # depends on loaded state

Preloading makes some collection reads memory-backed.

railsrevelry.substack.com/p/where-does...
Why N+1 Queries Are a Natural Result of Lazy Loading
Why loading the parents doesn't load their associations — and why preloading doesn't fix every repeated query.
open.substack.com
July 19, 2026 at 6:40 AM
Two Active Record objects can represent the same row, compare as equal, and still carry different values. This RailsRevelry article explains model object snapshots, reload, lifecycle predicates, and the debugging difference between object state and database truth.

open.substack.com/pub/railsrev...
An Active Record Object Is a Snapshot, Not the Row
A loaded model instance represents database-backed state at one moment. It is not synchronized database truth.
open.substack.com
July 5, 2026 at 7:18 AM
This Rails line can be much more expensive than it looks: invoices.present?

If invoices is unloaded ActiveRecord::Relation, present? can load records.

A relation is deferred query intent, not database truth.

When Does an Active Record Query Actually Run?
railsrevelry.substack.com/p/when-does-...
When Does an Active Record Query Actually Run?
Active Record queries often look like loaded records before Rails has touched the database. This article traces how relations accumulate intent, which methods force SQL, and why present? can load too ...
railsrevelry.substack.com
June 28, 2026 at 10:03 AM
current_user reads like global Rails state, but it is request identity moving through scoped owners:

session → env["warden"] → Warden::Proxy → @current_user → Current

That's why it works in controllers but not in jobs, and becomes dangerous in middleware.

railsrevelry.substack.com/p/where-does...
Where Does current_user Actually Live?
The request-local life of identity across Warden, Devise, CurrentAttributes, and the Rails Executor.
railsrevelry.substack.com
June 21, 2026 at 9:49 AM
I’ve been rereading Polished Ruby Programming by Jeremy Evans, and wrote about one section that stuck with me: SOLID design in Ruby.
Not as doctrine. More as a set of prompts.

syedaslam.com/posts/what-s...
What SOLID Still Teaches Ruby Programmers | Syed Aslam
How SOLID changes when you read it through Ruby’s object model, duck typing, and preference for pragmatic design.
syedaslam.com
June 18, 2026 at 8:03 PM
Rails is one of the few technologies that have survived long enough to be judged on outcomes rather than novelty.

Teams are still choosing it for greenfield projects because the productivity advantages compound over the lifetime of a product, not just during the first few weeks of development.
June 2, 2026 at 1:08 PM
One Rails convention that becomes clearer once you see the machinery:

def show
@user = User.find(params[:id])
end

This can still render app/views/users/show.html.erb.

Not because Rails guesses a file, but because Action View resolves a template lookup query.

open.substack.com/pub/railsrev...
How Rails Finds the View to Render
Rendering is not "show the file." Rails builds a lookup query from the controller, action, format, variant, and view paths, then resolves the best matching template.
open.substack.com
May 31, 2026 at 7:59 AM
RailsRevelry is a weekly Rails internals publication for developers who can build Rails apps but want a better grip on what the framework is doing underneath.

The focus is request flow, middleware, routing, controller dispatch, rendering, and the execution boundaries that shape real Rails behavior.
May 18, 2026 at 1:18 AM
I used to think of `before_action` mostly as a Rails convenience.

The better framing is request prerequisites.

Before an action, the app often needs to identify the user, the account the request belongs to, and whether the request should continue at all.

railsrevelry.substack.com/publish/post...
Why Rails Runs Code Before Your Controller Action
Your Rails action may look small because the real request boundary lives above it. `before_action` is where Rails lets a controller declare what must happen before action-specific code gets a turn.
railsrevelry.substack.com
May 17, 2026 at 9:59 AM
Rails `params` feels like one object because that is how we read it in controllers.

But it is not one thing.

It is a merged request structure built from:

- route params
- query params
- request body params
May 10, 2026 at 10:57 AM
A useful Rails distinction:

Routing decides where the request goes.
Dispatch decides how it gets executed.

That one distinction explains much of the controller-level confusion.
May 6, 2026 at 1:08 PM
What changes when Rails work leaves the request-response path and starts running later, elsewhere, or under a different failure model?

That is the question behind background jobs, async mailers, `after_commit` callbacks, lifecycle hooks, and event-style workflows.

syedaslam.com/posts/the-ex...
The Execution Boundary in Rails | Syed Aslam
What changes when Rails work leaves the request-response path and starts running later, elsewhere, or under a different failure model.
syedaslam.com
May 4, 2026 at 2:38 PM
How Rails Dispatches a Request to a Controller

“The route matches and then the action runs” leaves out an important part of how Rails actually works.

b/w those two points, Rails resolves the controller, instantiates it, builds request state, and runs callbacks.

open.substack.com/pub/railsrev...
How Rails Dispatches a Request to a Controller
A clear explanation of what happens after routing chooses an endpoint: controller resolution, params setup, callback execution, and response handling.
open.substack.com
May 3, 2026 at 4:10 PM
Rails routing isn’t smart.

It’s deterministic.

It matches a request against your route set, in order, and dispatches to the first match.

That single idea explains most routing “mysteries.”

Wrote a breakdown of how it actually works:

open.substack.com/pub/railsrev...
How Rails Routing Works: Turning URLs into Controller Actions
A clear mental model for how Rails matches requests, extracts params, and dispatches controller actions.
open.substack.com
April 26, 2026 at 10:07 AM
New article: Inside the Rails middleware stack.

The core idea: middleware is not a checklist before your controller. It is a chain of Rack wrappers around your app.

That explains sessions, redirects, headers, and why some requests never reach your controller.

open.substack.com/pub/railsrev...
Inside the Rails Middleware Stack: How Requests Actually Move Through Your App
Rails middleware is not just a list of steps that run before your controller. It is a chain of Rack wrappers around your app, and that one mental model explains request IDs, sessions, redirects, heade...
open.substack.com
April 25, 2026 at 9:14 PM
I’ve been wanting to write more about how Rails actually works under the hood, not just how to use it.

So I started RailsRevelry. Explaining what really happens between an HTTP request hitting your app and your controller action running.

railsrevelry.substack.com/p/from-rack-...
Rails Revelry | Syed Aslam | Substack
Understanding how Rails actually works. Click to read Rails Revelry, by Syed Aslam, a Substack publication. Launched 6 days ago.
railsrevelry.substack.com
April 18, 2026 at 12:26 PM