Rails, JavaScript, architecture, product.
https://syedaslam.com
https://railsrevelry.substack.com
railsrevelry.substack.com/p/active-job...
railsrevelry.substack.com/p/active-job...
railsrevelry.substack.com/p/when-shoul...
railsrevelry.substack.com/p/when-shoul...
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...
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...
syedaslam.com/posts/why-ac...
syedaslam.com/posts/why-ac...
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-...
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-...
syedaslam.com/posts/git-wo...
syedaslam.com/posts/git-wo...
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...
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...
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...
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...
open.substack.com/pub/railsrev...
open.substack.com/pub/railsrev...
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-...
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-...
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...
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...
Not as doctrine. More as a set of prompts.
syedaslam.com/posts/what-s...
Not as doctrine. More as a set of prompts.
syedaslam.com/posts/what-s...
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.
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.
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...
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...
The focus is request flow, middleware, routing, controller dispatch, rendering, and the execution boundaries that shape real Rails behavior.
The focus is request flow, middleware, routing, controller dispatch, rendering, and the execution boundaries that shape real Rails behavior.
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...
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...
But it is not one thing.
It is a merged request structure built from:
- route params
- query params
- request body params
But it is not one thing.
It is a merged request structure built from:
- route params
- query params
- request body params
Routing decides where the request goes.
Dispatch decides how it gets executed.
That one distinction explains much of the controller-level confusion.
Routing decides where the request goes.
Dispatch decides how it gets executed.
That one distinction explains much of the controller-level confusion.
That is the question behind background jobs, async mailers, `after_commit` callbacks, lifecycle hooks, and event-style workflows.
syedaslam.com/posts/the-ex...
That is the question behind background jobs, async mailers, `after_commit` callbacks, lifecycle hooks, and event-style workflows.
syedaslam.com/posts/the-ex...
“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...
“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...
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...
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...
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...
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...
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-...
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-...