r/rails • • 3d ago

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

Thumbnail ruby-lang.org
16 Upvotes

r/rails • • 3d ago

πŸ’Ό jobs megathread Work it Wednesday: Who is hiring? Who is looking?

4 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/rails • • 19h ago

Using the Official Ruby Image for Rails Dev Containers

Thumbnail t27duck.com
15 Upvotes

I got tired of waiting for rails/devcontainer to update/release for Ruby 4.0.10, so I dug around and figured out how to use the official Docker hub image instead. One less thing I need to wait to update for when a new Ruby version drops.


r/rails • • 1d ago

How do you move forward time in the Docker stack

0 Upvotes

Trial expiry, renewal reminders, "delete after 30 days" jobs: I kept testing these by editing timestamps in the database by hand, and still missed bugs because Postgres, Redis and the workers never agreed on what day it was.

So I built ChronoStack. You run your app's docker compose stack through it and move time forward for everything at once:

chronostack up --wait

chronostack advance 14d

Postgres now(), Redis TTLs and your Rails and Sidekiq processes all see the new date together, with no code changes. It runs a separate copy of your stack, so your real data isn't touched.

For Sidekiq specifically:

Jobs queued with perform_in / perform_at just work. The scheduled-job poller sees the virtual clock, so a job due "in 14 days" runs when you advance 14 days.

A built-in sidekiq barrier waits at every step until the queues are drained and running jobs are finished, so nothing gets cut off mid-jump.

sidekiq-cron is the exception. It only runs a job if it polls within 60 s of the job's time, so a jump skips it. For those you declare a trigger that runs the job at its time.

I tried it on a few open-source apps. In Chatwoot (Rails), snoozed conversations were never reopened if the snooze had ended more than 3 days before the job ran, for example after a background-job outage. Their team confirmed it as a bug. It found similar date bugs in five other projects too.

It's free, open source and in alpha. Works on Linux, Windows and Intel Macs; Apple-silicon Macs aren't tested yet. I'd really like to hear from someone running it on their own Rails app: what works, and what breaks (chronostack doctor output helps).

https://github.com/Asmodeus14/ChronoStack


r/rails • • 3d ago

News Ruby Security Alert: Patch to 4.0.10, 3.4.13, or 3.3.14

120 Upvotes

If your team runs Ruby in production, I’d make time to patch today. Ruby 4.0.10, 3.4.13, and 3.3.14 are rolling out with fixes for seven vulnerabilities in regular expressions and string methods like upcase. Some can lead to remote code execution.

If you’re on Ruby 3.2 or older, your branch won’t get these fixes. Talk with your team about moving to a supported version.

Here’s the official Ruby security advisory. Pass it along to someone who looks after a Ruby app.

Happy Wednesday!


r/rails • • 2d ago

Can you patch Ruby faster now?

Thumbnail paagman.dev
2 Upvotes

r/rails • • 2d ago

Looking for Ruby Developers to Collaborate on pinterest-dl

Thumbnail reddit.com
1 Upvotes

r/rails • • 4d ago

Discussion Improving jemalloc's memory use

Post image
27 Upvotes

Long-running Rails 8.1 app (Ruby 4.0, Puma single mode, 5 threads, jemalloc) on a 512 MB Heroku dyno had a slow native memory creep for over a year. Ruby's object count stayed flat while RSS kept climbing, sometimes to the point of swapping or crashing. The chart shows the before and after. On the left, jemalloc's allocated memory saws upward toward 400+ MB between restarts. What fixed most of it was forcing a full GC every 300 seconds in Puma's out-of-band hook, between requests, so it never adds latency.

After that I set RUBY_GC_HEAP_FREE_SLOTS_MIN_RATIO=0.10, GOAL_RATIO=0.15 and MAX_RATIO=0.25 so Ruby keeps less empty heap around. Allocated memory now sits flat around 200 to 240 MB, and boot memory dropped by another 35 MB. RSS growth went from about 25 MB/h to 2 or 3 MB/h, and p95 latency actually went down. Next I'm trying min threads = max threads to stop Puma from creating and reaping threads all day.


r/rails • • 4d ago

Discussion I think `String#truncate_words` uses ~48 bytes of native memory per character after the cut point (one-line fix inside)

18 Upvotes

UPDATE: It also speeds up long string handling 10-100x. PR is now up. https://github.com/rails/rails/pull/59848

We build meta descriptions from long legal texts, some up to 1.25M characters, by calling #truncate_words. While chasing a slow RSS creep in production, I found that a single call on one of those strings peaks at about 58 MB of RSS with glibc, or 70 MB with jemalloc. None of it showed up in GC.stat or allocation profilers.

I believe the cause is the tail of the regex in ActiveSupport:

if self =~ /\A((?>.+?#{sep}){#{words_count - 1}}.+?)#{sep}.*/m

Once the Nth word and its separator are found, .* under /m goes on to match the whole rest of the string, and Onigmo pushes a backtrack entry for every character it consumes.

That stack is plain malloc, so you only see it as RSS. The .* never affects the result, because it can match an empty remainder and it isn't part of the capture. A lookahead does the same job:

-    if self =~ /\A((?>.+?#{sep}){#{words_count - 1}}.+?)#{sep}.*/m
+    if self =~ /\A((?>.+?#{sep}){#{words_count - 1}}.+?)(?=#{sep})/m

Peak RSS during one call (fresh process per case, Ruby 4.0.9, x86_64 Linux) and time from benchmark-ips:

LengthPeak RSS (before β†’ after)Time (before β†’ after)
1 K52 KB β†’ 09.6 Β΅s β†’ 6.3 Β΅s
100 K4.7 MB β†’ 0295 Β΅s β†’ 6.5 Β΅s
1 M47 MB β†’ 013.2 ms β†’ 6.1 Β΅s

PS: My workaround is to use a split-based helper instead of truncate_words.


r/rails • • 4d ago

Podcast πŸŽ™οΈ Remote Ruby – Rails Security, Hot Cell, and AI-Generated PRs

Thumbnail remoteruby.com
8 Upvotes

New Remote Ruby episode is out!

This week Chris, David, and I get into:

- Recent Rails security fixes, including Active Storage vulnerabilities
- Hot Cell and safer file uploads
- Unexpected changes in Rails content negotiation
- My new five-file rule for keeping AI-generated PRs reviewable
- Using stacked PRs and parallel AI coding sessions

I am curious how others are keeping AI-generated PRs manageable?


r/rails • • 5d ago

Minitest Rails Guide - a free hands-on guide for testing Rails apps with Minitest

Thumbnail minitestrails.com
18 Upvotes

For the last few months, I have been writing a free hand-on guide for automated testing using Rails default stack: Minitest + Fixtures.

Following the guide chapter by chapter, you build a real app for managing recipes called Cookbook while learning how to test different parts of the Rails application along the way.

It's a guide I wish I had when I started learning automated testing with Rails six years ago.

If you want your AI agents to go through it and instill the learning from the guide, you can point it to https://minitestrails.com/llms.txt . Every chapter also has a markdown version (just add .md to the chapter URL).

Feedback welcome!

If you see a topic missing, let me know in the comments. I will consider adding it.


r/rails • • 5d ago

Learning Fixing a persistent production issue in a Rails eCommerce app

1 Upvotes

Maintaining an established Rails app often means investigating problems that have been around for a while: recurring production errors, slow queries, or behaviour nobody can quite explain.

Our teammate Samuel Ebeagu wrote up how he investigated and fixed one such issue in an eCommerce app: https://widefix.com/blog/fixing-slow-delayed-job-queues-rails-heroku/

The post covers the investigation, the root cause, and the fix. Thanks to Yasir Guzman for reviewing it.


r/rails • • 6d ago

Rails + Inertia.js users: what downsides have you hit, and did any make you reconsider it?

18 Upvotes

I'm using Inertia.js with Rails and React on a side project, and so far I like it: controllers stay server-driven, there's no separate API to maintain, and routing stays in Rails.

Most of what I read about Inertia is positive though, so I'd like to hear the other side from people who've used it for a while or in production.

- What were the real downsides you ran into?

- Was there a point where it got in your way, like a feature that was awkward to build, performance, SSR, testing, or something else?

- Did anyone move away from it, or decide not to use it on a later project? What made you choose differently?

- If you'd start the same project again today, would you pick Inertia, Hotwire, or a separate API plus SPA?

Not looking to start a framework war, just want to know the trade-offs before the project grows.


r/rails • • 6d ago

Gem Rabarber v6.1: Reliability Update for the Rails Authorization Gem

7 Upvotes

Rabarber, a role-based authorization gem for Rails, releases v6.1.0.

This release is mostly about reliability. With the help of AI, a lot of work went into the internals, and many edge cases around transactions, caching, concurrent role changes and generated migrations were found and fixed. Updating is recommended for everyone.

This version also adds a way to create and delete several roles at once, and support for binary UUID primary keys in MySQL.

A few things are deprecated in this release. They still work for now, but will be removed in the next major version, planned for next year.

Details on these and all other changes are in the changelog.

Check out the gem here.

Happy coding!


r/rails • • 5d ago

The future of Rails

0 Upvotes

DHH gave a hint at Kaigi on Rails on the future of Rails.

Hint: Do Repeat Yourself

https://www.youtube.com/watch?v=ayVzHr75gls


r/rails • • 6d ago

Group Rails models, jobs and services by domain in an architecture test

0 Upvotes

A billing boundary rarely lives in one directory. You can have app/models/billing/, app/jobs/billing/ and app/services/billing/, and still want all of them to count as the same component.

One useful application of ArchUnitRuby's slices is grouping those paths by the domain name instead of by their Rails role. I work on the library; it's free and MIT-licensed.

require 'archunit'

slices = ArchUnit.project_slices('.')
  .defined_by_regex(%r{app/(?:models|jobs|services)/([^/]+)/})

diagram = <<~UML
  @startuml
  component [orders]
  component [billing]
  [orders] --> [billing]
  @enduml
UML

rule = slices.should
             .ignoring_external_slices
             .adhere_to_diagram(diagram)

options = ArchUnit::CheckOptions.new(
  dependency_analysis: :imports_and_constants
)
ArchUnit.assert_passes(rule, options)

The first regex capture becomes the component name. So a job under orders referring to Billing::Invoice is allowed. A billing model referring to its own Billing::InvoiceBuilder service is also allowed, even though those files live under different Rails directories.

But add a reference to Orders::ReceiptJob inside the billing model and the check reports a billing -> orders dependency, including the source file and constant-reference evidence.

That's the boundary I care about here

You can move behavior between a domain's model and service without changing the cross-domain policy. If billing needs to start reaching into orders, the diagram change makes that decision explicit.

This is static source analysis with constant references enabled, not a Rails runtime or callback check. The example covers the directories named in the regex, and uncertain constant ownership isn't guessed. The API is available in archunit 1.0.0: https://github.com/dragonsec-ai/ArchUnitRuby

Writing assisted by ChatGPT.


r/rails • • 7d ago

Skylight, Honey Badger, App Signal, Scout: they all suck.

0 Upvotes

tldr; Rollbar's ok as a Sentry alternative. All the others are too buggy for me.

Initial threshold:

  • If they have a blog, its current.
  • They use product language I understand as a developer.
NameCost for 1M req's.ErrorsAPMLogsCache Insight
Rollbar$20βœ…βŒβŒβŒ
Skylight$20βŒβœ…βŒβŒ
Honey Badger$30βœ…βœ…βœ…Didn't work
App Signal$40βœ…βœ…βœ…βŒ
Scout$40βœ…βœ…βœ…

Skylight

  • It shows allocations in a file even though I know the file isn't running because I'm caching it with a hash.
  • Graphs are incorrectly drawn and inaccurate.

HoneyBadger

  • Extra work (with Vector) required to get import logs.
  • Many Dashboard Widgets don't work, such as Cache Hit Rates and all Puma Widgets.

    • For Puma, need to add: plugin :honeybadger
  • Errors aren't showing up. (Maybe ActiveRecord errors are ignored by default?)
  • The table views hide much of the data and can't be horizontally scrolled.
  • It's unintuitive to scroll tables down. One must first move the mouse into the hard-to-see scroll pane. (Cf.: Skylight, which doesn't have this problem.)
  • The docs aren't very hyperlinked and the left navbar doesn't stay synced with the content. This makes it hard to navigate and find material.
  • Many of the Widgets feel very generic and not particularly helpful. They feel useless and time wasting in an enterprisey way.

AppSignal

  • πŸ˜ƒ Deploys automatically recognized.
  • πŸ‘Ž Can't dive into details for allocations and other aspects. The info feels very surface-level. Although, it seems to have been slimmed down to show only the most important details.
  • πŸ‘Ž I began getting frequent intermittent page outages.

Scout APM

  • πŸ˜ƒ Pre-written config file to get started.
  • πŸ˜ƒ Has Rollbar integration. I may use that if I prefer it to the Scout error tracking.

Update, 2026-11-14: Scout APM had multiple bugs when trying it via Heroku.

  • Lots of data missing, although DEBUG mode shows it being sent from my app.
  • Its GitHub release syncing stayed stuck on an older commit.

Removing it.


r/rails • • 8d ago

Podcast Marco Roth: Teaching Rails to Read Its Own Template

26 Upvotes

There's a new episode of On Rails out today with Marco Roth where we dig into some of the work he's been doing with Herb and ReActionView... and a bunch of other topics I really wanted to ask about... like, how do you navigate so much conference travel?

Listen in your favorite (or most bearable) podcasting app... or watch the conversation over on the official Rails youtube channel.

https://www.youtube.com/watch?v=ko60zbx6dOE

https://podcast.rubyonrails.org/2462975/episodes/20121188-marco-roth-teaching-rails-to-read-its-own-template

Happy Friday!

✌️


r/rails • • 8d ago

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

Thumbnail gallery
7 Upvotes

r/rails • • 8d ago

Learning Used Kamal to deploy my Rails side project and it just worked

Post image
0 Upvotes

r/rails • • 8d ago

Open source kamal-watch 0.9.1 released

7 Upvotes

Small QoL update regarding reboot functionality.

Side note: I couldn't find any rules against posting more than once a week, but if there are rules about something similar, please let me know.


r/rails • • 8d ago

Catch a presentation mixin leaking into a Rails model without a require line

1 Upvotes

A Rails model can pick up a presentation dependency through include Presentation::FormattedOrder without adding a require_relative anywhere. An import-only check can miss the relationship you actually care about.

I maintain ArchUnitRuby. There is an opt-in mode that adds known project constant references to the dependency graph:

options = ArchUnit::CheckOptions.new(
  dependency_analysis: :imports_and_constants
)
rule = ArchUnit.project_files
  .in_path('app/models/**')
  .should_not.depend_on_files
  .in_path('app/presentation/**')

ArchUnit.assert_passes(rule, options)

Require archunit in the test setup and adapt the two paths to your app.

I verified this with a model including a root-qualified presentation mixin. Import-only mode found no edge; the expanded mode reported the dependency. Removing the mixin made the rule pass.

That gives you a check for a real autoloading case without booting Rails to collect runtime references. It is still static analysis: dynamic constant definitions and ambiguous ownership have documented limits.

Disclosure: this post was drafted with AI assistance; the example was checked against the published gem.

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


r/rails • • 9d ago

Steadfast Update I - The Baseline

Thumbnail noteflakes.com
6 Upvotes