r/ruby • • 6d ago

Security Upgrade Ruby ASAP - Security advisories: multiple vulnerabilities in Regexp and String case conversations

Thumbnail
ruby-lang.org
129 Upvotes

r/ruby • • 20d ago

💼 jobs megathread Work it Wednesday: Who is hiring? Who is looking?

8 Upvotes

FORMAT HAS CHANGED PLEASE READ FULL DESCRIPTION

This thread will be periodically stickied to the top of the sub for improved visibility.

You can also find older posts again via the Megathreads" list, which is a dropdown at the top of the page on new Reddit, and a section in the sidebar under "Useful Links" on old Reddit.

For job seekers

Please adhere to the following rules when posting: Rules for individuals:

  • Don't create top-level comments; those are for employers.
  • Feel free to reply to top-level comments with on-topic questions.
  • Anyone seeking work should reply to my stickied top-level comment.
  • Meta-discussion should be reserved for the distinguished comment at the very bottom.

You don't need to follow a strict template, but consider the relevant sections of the employer template. As an example:

    TYPE: [Full time, part time, internship, contract, etc.]
    
    LOCATION: [Mention whether you care about location/remote/visa]
    
    LINKS: [LinkedIn, GitHub, blog, etc.]

    DESCRIPTION: [Briefly describe your experience. Not a full resume; send that after you've been contacted)]

    Contact: [How can someone get in touch with you?]

Rules for employers:

  • The ordering of fields in the template has been revised to make postings easier to read.
  • To make a top-level comment, you must be hiring directly; no third-party recruiters.
  • One top-level comment per employer. If you have multiple job openings, please consolidate their descriptions or mention them in replies to your own top-level comment.
  • Proofread your comment after posting it and edit it if necessary to correct mistakes.
  • To share the space fairly with other postings and keep the thread pleasant to browse, we ask that you try to limit your posting to either 50 lines or 500 words, whichever comes first.
  • We reserve the right to remove egregiously long postings. However, this only applies to the content of this thread; you can link to a job page elsewhere with more detail if you like.

Please base your comment on the following template:

    COMPANY: [Company name; optionally link to your company's website or careers page.]

    TYPE: [Full-time, part-time, internship, contract, etc.]

    LOCATION: [Where are your office or offices located? If your workplace language isn't English-speaking, please specify it.]

    REMOTE: [Do you offer the option of working remotely? Please state clearly if remote work is restricted to certain regions or time zones, or if availability within a certain time of day is expected or required.]

    VISA: [Does your company sponsor visas?]

    DESCRIPTION: [What does your company do, and what are you using Rust for? How much experience are you seeking, and what seniority levels are you hiring for? The more details, the better. If you are listing several positions in the "Description" field above, then feel free to include this information inline above, and put "See above" in this field.]

    ESTIMATED COMPENSATION: [Be courteous to your potential future colleagues by attempting to provide at least a rough expectation of wages/salary. See section below for more information.]

    CONTACT: [How can someone get in touch with you?]

ESTIMATED COMPENSATION (Continued)

If compensation is negotiable, please attempt to provide at least a base estimate from which to begin negotiations. If compensation is highly variable, then feel free to provide a range.

If compensation is expected to be offset by other benefits, then please include that information here as well. If you don't have firm numbers but do have relative expectations of candidate expertise (e.g. entry-level, senior), then you may include that here. If you truly have no information, then put "Uncertain" here.

Note that many jurisdictions (including several U.S. states) require salary ranges on job postings by law. If your company is based in one of these locations or you plan to hire employees who reside in any of these locations, you are likely subject to these laws. Other jurisdictions may require salary information to be available upon request or be provided after the first interview. To avoid issues, we recommend that all postings provide salary information.

You must state clearly in your posting if you are planning to compensate employees partially or fully in something other than fiat currency (e.g., cryptocurrency, stock options, equity, etc). Do not put just "Uncertain" in this case, as the default assumption is that the compensation will be 100% fiat. Postings that fail to comply will be removed. Thank you.


r/ruby • • 11h ago

stylebench: compare how different models write ruby, stylistically

Thumbnail nateberkopec.github.io
4 Upvotes

Vibe coded in an hour. Please send all feedback to https://github.com/nateberkopec/stylebench. If you wish there was a model here that I didn't include, go run it yourself!


r/ruby • • 1d ago

Blog post UUIDv7 primary keys in Rails and PostgreSQL

Thumbnail
randomerrata.com
32 Upvotes

r/ruby • • 1d ago

JRuby 9.4.16.0 Released with security updates

Thumbnail jruby.org
15 Upvotes

We are happy to announce the release of JRuby 9.4.16.0, a sponsored release mostly containing third-party security updates. Users still on JRuby 9.4 are encouraged to update and sign up for support services at https://headius.com to assist with future releases and upgrading to JRuby 10.x.

JRuby 9.4.x targets Ruby 3.1 compatibility.

Thank you to our contributors this release, you help keep JRuby moving forward! @jessecai33, @mnpoonia

Notable Changes

Security

Compatibility

  • Improved handling of ruby2_keywords argument passing. #9517
  • Marshal dump and load of an identity hash no longer loses identity bit. #9584

Java Integration

  • JVM bytecode output will now better match the current JVM, up to the limits of the ASM bytecode library. #9483

5 Issues and PRs resolved for 9.4.16.0


r/ruby • • 2d ago

Steadfast Update II - Rewriting ASTs

Thumbnail noteflakes.com
7 Upvotes

r/ruby • • 2d ago

Agent_primitives – capabilities your coding agent has to prove with specs

0 Upvotes

**Edited to better explain my ramblings. Hopefully...

Morning all,

You ask a coding agent to refactor the comments view. It breaks reply nesting, and this spec fails:

it "shows replies nested under their parent" do
  expect(page).to have_css(".comment .comment", text: "Nice post")
  expect(page).to have_css(".comment[data-depth='1']")
end

The agent "fixes" the failure by deleting the second assertion. The suite is green. The only evidence is one hunk in a 600 line diff, and nothing tells you that this spec mattered more than the forty around it.

Tests protect your code, but nothing protects the tests. That matters once agents write both.

I've released agent_primitives, a gem that covers that gap. It has two parts.

1. You write down what the app must keep doing. Each capability gets a short doc with plain numbered sentences:

I1 — A reader can reply to any comment.
I2 — Replies show nested under their parent.

2. You tag the specs that prove each sentence.

it "shows replies nested under their parent", intent: "comment_threads#I2" do

These are ordinary RSpec examples and they run as before. The tag is just metadata.

Now the same agent edit gets reported:

$ bundle exec agent_primitives guard --base main
spec/system/comment_threads_spec.rb
  7:1   N  the example proving comment_threads#I2 lost 1 assertion(s) — it still carries the tag while proving less of the clause   [proof/weakened]

If the agent deletes the example outright, the check that runs in CI fails:

$ bundle exec agent_primitives evals
docs/primitives/capabilities/comment_threads.md
  9:1   E  spec/system/comment_threads_spec.rb carries no `intent: "comment_threads#I2"` tag   [evaluation/untagged]

1 capability, 4 clauses — 1 offence

Rewording a sentence is reported too, so an agent can't change what the app is supposed to do without you seeing it.

A few other things it does:

  • The agent reads the doc before it plans a change, so it stops "fixing" deliberate decisions that look like bugs.
  • Each doc keeps a history of decisions and rejected alternatives, so the agent stops proposing the approach you turned down last month.
  • It works forwards. Write the sentences before the code, and each one becomes a spec the agent has to make pass.
  • You don't write the docs by hand. The gem ships agent skills that fold this into planning, building and review, and one that interviews you to backfill an existing feature.

It needs RSpec and an agent that can load skills.

gem "agent_primitives", group: :development

Source and README: GitHub - pitch-sourcery/agent_primitives · GitHub

I extracted it from the harness I use every day on my own startup's Rails app. It's a 0.1.0, so tell me where it's confusing or wrong.


r/ruby • • 5d ago

Blog post Can you patch Ruby faster now?

Thumbnail paagman.dev
41 Upvotes

r/ruby • • 5d ago

Looking for Ruby Developers to Collaborate on pinterest-dl

8 Upvotes

I've been working on a Ruby project called pinterest-dl and thought it would be nice to have a few other developers involved in it

It's a tool for extracting media URLs from Pinterest and downloading images and videos

I'd like to find a couple of Ruby developers who are interested in working on it together — things like improving the code, writing tests, fixing bugs and coming up with new ideas or features

You don't have to be an expert or have tons of experience
I'm just looking for people who enjoy Ruby and are interested in contributing to an open-source project

It would be nice to have a few people to share ideas with and build this thing together instead of working on everything alone :)

Here's the repo if you want to check it out:

https://github.com/monji024/pinterest-dl

Feel free to reach out if you're interested!


r/ruby • • 5d ago

Gemstash 2.9.0 security release, and the end of Gemstash

Thumbnail
blog.rubygems.org
16 Upvotes

r/ruby • • 7d ago

Improving jemalloc's memory use

Post image
8 Upvotes

r/ruby • • 7d ago

Podcast 🎙️ Remote Ruby – AI Coding Agents, Ruby Tooling, and Smaller PRs

Thumbnail
remoteruby.com
4 Upvotes

New Remote Ruby episode is out!

This week Chris, David, and I talk about how AI is changing Ruby development, including:
- My five-file rule for AI-generated pull requests
- Stacked PRs and parallel AI coding sessions
- Automating dependency updates and security fixes
- RubyGems, Bundler, and Active Record improvements

How are you keeping AI-generated code manageable and reviewable?


r/ruby • • 8d ago

Blog post Fixing a persistent production issue in a Rails eCommerce app

Thumbnail
reddit.com
0 Upvotes

r/ruby • • 9d ago

Four methods can still be two unrelated jobs: inspecting cohesion in a Ruby class

0 Upvotes

A method-count limit wouldn't flag this class:

class InvoiceService
  def charge; @gateway.charge; end
  def refund; @gateway.refund; end
  def render; @template.render; end
  def filename; @template.filename; end
end

It's only four methods. But charge/refund operate on one field, while render/filename operate on another. If you're looking for a possible payment/rendering split, that's a more interesting signal than the size alone.

I work on ArchUnitRuby, a free MIT-licensed gem. Its LCOM4 implementation counts connected groups of methods through shared fields. On this source it returns 2:

require 'archunit'

scope = ArchUnit.metrics('.')
                .for_classes_matching('InvoiceService')

scope.lcom.lcom4.measure.each do |item|
  puts "#{item.identifier}: #{item.value}"
end

Change the four methods to charge, refund, void and status, all using @gateway, and the same measurement is 1. The method count is still four.

I wouldn't turn that into a universal "LCOM4 must equal 1" gate. A constructor touching both fields can connect these groups, and Ruby methods that collaborate through calls won't necessarily share a field. This implementation measures field sharing, not whether your domain model is good.

A useful thing to inspect, though

For me the interesting use is narrowing a review: find a service with separated groups, look at what each group does, then decide whether splitting it actually makes the code easier to change. The number starts that conversation; it doesn't settle it.

The measurement API shown here is in the published archunit gem, version 1.0.0.


r/ruby • • 11d ago

Formatting an entire 25 million line codebase overnight: the rubyfmt story

Thumbnail
stripe.dev
38 Upvotes

r/ruby • • 11d ago

Free and Open Source Error Tracking, APM, and Uptime monitoring in Ruby on Rails

Thumbnail
gallery
35 Upvotes

After work, I am always building my side projects, usually in Ruby and/or Rails. Over the years I have accumulated a lot of small web apps and now with AI, I'm building more apps at a faster rate. They all need error tracking, APM, and uptime monitoring. I don't want to have to keep paying for monitoring services, especially since my apps are all so small, so I decided I would just build one to handle all my errors, uptime, and APM needs.

I've open sourced the web app here https://github.com/creativesorcery/goodsorcery_web
And corresponding ruby client gem here https://github.com/creativesorcery/goodsorcery-ruby

It doesn't have all the bells and whistles, but I think it gets the job done at least for my needs. I did add an MCP endpoint there, so AI agents can query and investigate errors and APM data. I hope others will find it useful.


r/ruby • • 11d ago

Podcast Marco Roth: Teaching Rails to Read Its Own Template

Thumbnail
reddit.com
6 Upvotes

r/ruby • • 11d ago

Ruby constant lookup needs more than matching the last name

0 Upvotes

Store and ::Billing::Store aren't interchangeable names just because they end the same way. Once a Ruby project has nested namespaces, a dependency tool needs to account for where a reference lives.

I maintain ArchUnitRuby. Its opt-in constant analysis resolves known project definitions and records the dependency on the defining file, rather than treating every occurrence of the word Store as the same thing.

The supported lookup model includes lexical nesting and explicit root-qualified references. It also has limits: reopened definitions can be ambiguous, and dynamic constant operations aren't a license to guess which file owns a name.

I verified a qualified project-constant reference against a file boundary: it produced a violation, while unrelated code in the same selected file passed. The constant didn't need a matching require_relative to appear in the graph.

This is useful when import-only rules are too quiet for your Ruby codebase. Enable dependency_analysis: :imports_and_constants deliberately and review the documented lookup limits before treating the graph as complete.

Source: https://github.com/dragonsec-ai/ArchUnitRuby


r/ruby • • 12d ago

Steadfast Update I - The Baseline

Thumbnail noteflakes.com
6 Upvotes

r/ruby • • 12d ago

I got tired of Pinterest being difficult to download from, so I made a Ruby gem

Post image
21 Upvotes

So... I made a Pinterest downloader in Ruby

I started this because downloading stuff from Pinterest can be surprisingly annoying.

Sometimes you just want the original image, sometimes it's a video, sometimes it's buried in a board, and sometimes the website decides to make a simple request way more complicated than it needs to be.

So I started building pinterest-dl.

A few things I wanted to solve:

  • Getting images in their available quality instead of ending up with a tiny preview.
  • Downloading videos without manually digging through Pinterest's page data.
  • Extracting direct video URLs when you don't actually need to download the file yourself.
  • Searching Pinterest and downloading entire boards instead of opening pins one by one.
  • Handling cookies when content needs an authenticated session.
  • Making batch downloads less painful.

It's not just a CLI either. I wanted it to work as a Ruby library, so it can be used in scripts and other applications too.

I'm sure there are things I could've done better, so I'd genuinely like to hear what other Ruby developers think about the implementation and API.

Repo: https://github.com/monji024/pinterest-dl

I thought this would be a tiny weekend project. Apparently, Pinterest had other plans.


r/ruby • • 14d ago

Show /r/ruby Going all-in on Sorbet

Thumbnail
docspring.com
13 Upvotes

r/ruby • • 14d ago

I built a VS Code extension for ERB, Haml and Slim that understands Rails views (checks, safe formatter, go-to-partial)

5 Upvotes

Hi r/rails,

I spend most of my day in app/views, but editor support for templates has always felt limited compared to what I get in .rb files. So I built Ruby Templates, a free, MIT-licensed VS Code extension for ERB, Haml, and Slim. No extra gems required.

What it does

  • Reports errors as you type. It shows Ruby syntax errors directly in your templates, flags unclosed tags, and reports Haml/Slim errors using the engines’ own messages.
  • Adds Rails-aware navigation and completion. Press F12 on render "users/card" to open the partial. Completion covers partials, ViewComponents, *_path helpers, model columns, controller-defined @ivars, and t(".keys").
  • Formats templates with safety checks. By default, the formatter only changes whitespace and checks that the template still compiles the same way before saving changes. If it can’t verify that, it leaves the file alone.
  • Catches Rails issues, including some I kept running into during code reviews:

    • <% render "x" %> that doesn’t output anything, and the same issue with link_to and other helpers;
    • <%= if … %> where <% if … %> was intended;
    • binding.irb or debug left in a view;
    • an @ivar used inside a partial;
    • an unused entry in locals:;
    • a render call in a loop that could use collection:;
    • raw or html_safe used on user content;
    • a relative translation key such as t(".key") missing from en.yml;
    • a data-controller reference with no matching Stimulus controller;
    • button_to inside form_with, which creates nested forms.
  • Checks for HTML and accessibility issues, such as missing alt attributes, duplicate IDs, <a> tags without href, and “click here” link text.
  • Supports per-project configuration through .ruby-templates.toml. You can enable or disable rules by folder and opt into stricter formatting rules, such as a particular quote style or one attribute per line.
  • Runs the same checks in CI: npx @x-ror/ruby-templates check app/views and npx @x-ror/ruby-templates format --check.

It works alongside Ruby LSP: Ruby LSP handles your .rb files, and Ruby Templates handles your templates.


r/ruby • • 14d ago

I made a gem that keeps pgvector embeddings in sync with your ActiveRecord models

1 Upvotes

I've been adding semantic search to Rails apps with pgvector and neighbor, and kept writing the same glue code every time:

  • an after_save that calls the embeddings API, even when the text didn't change
  • embeddings going stale when someone edits a record through a path that skips the callback
  • a one-off script to backfill existing rows without hitting rate limits
  • figuring out which rows need re-embedding after switching models

So I pulled it into a gem called embed_sync:

class Product < ApplicationRecord
  has_neighbors :embedding
  has_embedding :embedding, from: %i[name description]
end

Product.create!(name: "Trail runner", description: "Waterproof running shoe")  # embedded in a background job
Product.semantic_search("shoes for rainy hikes", limit: 5)

What it does:

  • re-embeds in a background job only when the source text changes (it stores a digest, so unchanged saves don't call the API)
  • bin/rails embed_sync:backfill embeds existing rows in batches, and you can stop and rerun it safely
  • detects model or dimension changes and marks those rows stale
  • embed_sync:stale shows how many records are missing or out of date
  • uses ruby_llm by default, but any object with #embed(texts, model:) works as a provider

It works with Rails 7.1 to 8.1 and Ruby 3.2+. I tested it against a real app with Postgres, Solid Queue and a local Ollama model before releasing.

It's still early (v0.1.0), so I'd really like feedback. Does the API feel right? What's missing for your use case? Are there edge cases I haven't thought of?

GitHub: https://github.com/Umair0092/embed_sync RubyGems: https://rubygems.org/gems/embed_sync


r/ruby • • 14d ago

Show /r/ruby The Ruby Stained-Glass will be out for Christmas

Thumbnail
gallery
23 Upvotes

Hey Ruby friends,

5 months ago, I wrote on r/ruby that I would build a limited-edition stained-glass inspired by Ruby. Well, it's November and I'm about to officially launch. 🤞🏻

I didn't want to spam the subreddit with each weekly update I've written over the past few months, but since we're close to its release, I wanted to keep you all posted.

What started as a joke and as a "simple" stained-glass eventually turned into a cool decorative object with glass (obviously) but also wood, a bit of electronics and 3D printing.

If you want to learn more (and get the launch date in advance), I've built a page dedicated to the project. You'll find all the episodes of "the Ruby Stained-Glass Notes", the weekly updates I've been writing since May. They're full of stained-glass nerdery ("How did they cut glass in 1175?"), of my thoughts/questions/learnings, of GIFs of me cutting glass and soldering panels...

I've been quite lucky to talk and meet Rubyists around the world thanks to this project, so I'm happy to answer any questions you might have.