The Lapidary Lemur

Rails: The Sharp Parts. Callbacks Are Not Invariants (opens in new tab)

Callbacks promise that something always happens when a record changes. They can't keep that promise, and Rails documents the ways out. Every failure mode here ran against ActiveRecord 8.1 before it went in, and the replacement is a command with one door.

Read the original article
Sign in to keep reading the full article.

Covered in 1 article

Hi, we're Arkency·
Feeds

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help