RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Submit a post

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

Today

What an Active Record Connection Pool Actually Controls

A two-thread Active Record 8.1.4.1 reproduction shows a checkout timeout after the holder’s query has finished. Moving the wait outside its connection block lets the other thread proceed. A second experiment compares ordinary model lookups, outer connection blocks, and persistent leases from Base.connection. Read more

Unpacking arr.max_by &arr.tally

A one-liner from Ruby Weekly #828 returns the most frequent element in an array. This post unpacks why it works: & calls to_proc, and a Hash’s to_proc is a key lookup, which also means it quietly returns nil for missing keys. It also benchmarks the “faster” rewrite, arr.tally.max_by(&:last): 2.2x faster with many duplicates, 1.4x slower when most elements are unique, with allocation counts showing why.

oops 0.8.1: four more token formats masked, even when shell quotes split them

oops copies your last shell command and its output as one Markdown block, so you can paste a failure into an issue, Slack or an AI chat. It masks the tokens it recognizes before copying, and 0.8.1 recognizes four more: Discord bot tokens, Supabase secret keys (sb_secret_; publishable keys stay visible), Notion and Linear, all contributed by one person. Read more

Snails: Rails conventions, native performance

Snails is a Rails-like framework for API-only Ruby apps. It keeps the Rails conventions, drops the Ruby runtime, and compiles the app, the framework, and the HTTP server into one native binary. The trade-off: no Active Record or gem compatibility. Models are plain classes — no callbacks, scope chains, or joins — and queries use the Sqlx query API. What you get: about 3× the requests per second of Rails in cluster mode, with 10× lower peak memory under load. Read more

oops 0.8.0: find that command from twenty minutes ago by a word in it

oops pick only lists the last 10 commands. When the one you want scrolled away long ago, oops 0.8.0 lets you search for it: oops grep timeout copies the last command whose command line or output contains “timeout” (case-insensitive, colors ignored) as one Markdown block, tokens and emails masked. -n 3 takes the last three matches, and --pick lists them so you choose. Read more

Loading older posts