R
GHSA-744p-w4gc-m3gh This is a vulnerability in the Trilogy library which is used by the Active Record Trilogy adapter. We believe it’s likely applications using Trilogy as their MySQL adapter are vulnerable and should upgrade immediately. This has not yet been assigned a CVE identifier, I will update the report when it is. Summary Trilogy#escape produces unsafe output for Strings in Shift_JIS, Windows-31J, Big5, GBK or GB18030. In those encodings, the continuation byte of a multi byte character…
R
Interesting, I think the most useful part of that PR for this case is actually making processed? public, rather than the immediate processing option. Looks like it was merged in December 2025, though the changes are still on main for Rails 8.2, not the current 8.1 release. With 250 MB+ images, I’d be hesitant to use process: :immediately, since that means doing the variant processing during attachment. Keeping it in a background job seems like a better fit here. Once processed? is public, you…
R
optimizer_hints carries over to every SELECT a relation builds, but update_all and delete_all drop it without any warning: Post.optimizer_hints("INDEX(posts index_posts_on_author_id)").where(author_id: 1).update_all(title: "x") # UPDATE `posts` SET `posts`.`title` = 'x' WHERE `posts`.`author_id` = 1 where, order, limit and annotate all make it into the statement, so you expect the hint to make it in as well. The usual reason to reach for a hint is that MySQL picks the wrong plan on a big table,…
R
Hi all I’d like to share FixtureKit, a gem we built at Gusto to make our test suite faster without asking hundreds of engineers to change how they write test setup. The problem Rails fixtures are fast. Data goes into the database once, and every test runs inside a transaction that rolls back. But in a large app with thousands of models and teams with varying Rails experience, keeping a clean set of YAML fixtures isn’t realistic. So teams reach for FactoryBot. It’s readable and flexible, but it…
R
Good afternoon, I would like to connect with fellow Ruby on Rails programmers to learn more about it. I am a intermediate developer with a few hundred hours of coding experience looking to expand my skills to find work. We can exchange contact information, if you are interested in talking and sharing information.
R
I have a form in my app where users can bulk edit some tag names. Once the operation is finished, I would like to display a page featuring all concrete changes to these records. When using Turbo, it requires me to redirect to some other page after form submission instead of rendering a regular HTML page with status code 200. My setup is pretty much like this: # config/routes.rb resources :tags do collection do get "bulk-edit" # use same path to prevent RoutingError in case of refresh post…
R
The Upgrading guide lists the minimum Ruby for each Rails series, but it is harder to find which newer Rubies are tested for that series. Today that information lives in rails/buildkite-config, with related policy discussed in issue comments: In rails/rails#31340, @rafaelfranca gave the rule: the newest supported Ruby is the newest one that existed when the series stopped being supported. In rails/rails#47811, @matthewd suggested publishing a recommended Ruby range per series on Ruby on Rails…
R
We’re giving away free tickets to students, recent grads, people from underrepresented groups, and those who recently changed careers and just started writing Ruby so we can continue growing the community. If you know anyone who fits, share this post with them and invite them to apply (takes 3 mins): Scholarship Program - San Francisco Ruby Conference 2026 The deadline is October 30! Note: We don’t cover travel or accommodation.
R
Peer Allan: In our app we need to display the amount of time passed since an object was created in the UI. Out of the box it looks like time_ago_in_words was going to do the job. However, in our case we need to know the time in a specific unit, in this case days. By happenstance the important calculate numbers are in the 120 days range which causes time_ago_in_words to swap to ‘months’. We had to create custom method to handle this which partly duplicates the Rails code. I have a patch to…
R
Here is the pull request: Add the `identity: true` column option to the PostgreSQL adapter by yahonda · Pull Request #59262 · rails/rails · GitHub
R
Thank you for writing this up. I’m also interested in this. I’d like Rails to be able to create identity columns with the migration DSL, and luckily, now that Rails requires PostgreSQL 10 or later, we no longer need to handle PostgreSQL versions without identity columns. Here is one possible way to move forward. As a first step, an identity: true column option could let identity columns be created with the migration DSL and keep them in schema.rb, which is useful on its own: create_table…
R
One reason I prefer window functions where possible is because everything is evaluated with one scan operation. So with every additional function you need then having all those multiple window functions can end up being multiple times faster than using subqueries: There are more complex examples though that window functions can’t address. In that light perhaps we can create a more involved example and see what kind of options would exist. Some kind of “reference case”. Incidentally, I have…
R
FILTER works well for simple conditions, but if I still need the scopes elsewhere, this approach duplicates their logic in SQL strings. My example uses a very simple scope; real scopes may be more complex, and they can change over time. Once the same logic lives in both a scope and a FILTER clause (or any other raw SQL), the two can silently drift apart: it’s easy to update a scope and miss the raw SQL that’s supposed to mirror it.
R
I suppose in that case I’d use windowing functions with FILTER, which would also mean no need for the scopes: User.left_joins(:orders).group(:id).select('users.*', 'SUM(orders.amount) FILTER(WHERE shipped_date IS NULL) AS pending_order_total', 'SUM(orders.amount) FILTER(WHERE shipped_date IS NOT NULL) AS shipped_order_total') To me having correlated subqueries managed by ActiveRecord feels quite a bit more involved. (Although using FILTER is only supported in Postgres, Sqlite, Oracle, and…
R
Why don’t you just use a GROUP BY? That works for a single aggregate, but it breaks down for multiple aggregates. Say you want both pending and shipped totals: User.left_joins(:pending_orders, :shipped_orders) .group(:id) .select("users.*", "SUM(orders.amount)", "SUM(shipped_orders_users.amount)") This runs into a fan-out problem: the two joins multiply rows (pending × shipped), so each sum is inflated by the other’s row count. And the second join gets a Rails-generated table alias you have to…
R
Why don’t you just use a GROUP BY? User.left_joins(:pending_orders).group(:id).select('users.*', 'SUM(orders.amount)')
R
When building subqueries from associations, Active Record knows how to express an association as join constraints against its owner’s table (that’s how joins and where.associated work), but that logic isn’t exposed as a relation you can embed in another query. That makes correlated subqueries, a common and often efficient SQL pattern, awkward to write without either duplicating association logic or reaching into internals. Given: class Order < ApplicationRecord belongs_to :user scope :pending,…
R
Tested and working alternative GitHub - palkan/isolator: Detect non-atomic interactions within DB transactions · GitHub This don’t need to be in rails, the feature is good as a gem. Also rails recently introduced a feature to enqueue jobs only after the transaction commits.
R
Update (Oct 19) A few things moved since this post. The harness is public: zoolutions/ractor-survey. It’s the app behind the numbers above, with its request runner and the one-gem survey. Each workaround has its own WA_* switch and links to its upstream fix, so every run shows exactly what it worked around. It has its own 22 requests, not the Shopify runner’s 16. From a clean clone on Ruby 4.0.7: 3 of the 22 pass with only the boot workaround on; 21 pass with all of them on. The last one calls…
R
Since Gotenberg has not come up yet, here is a side by side of the four options people usually weigh now. All four print with Chromium, so layout will differ a little from wkhtmltopdf’s Qt WebKit. Moving one document type at a time makes the differences easy to spot. Grover (Puppeteer from Ruby) Setup: add the gem, then npm install puppeteer, which also downloads Chromium. With a remote browser such as the browserless container mentioned above, install puppeteer-core instead and pass…
R
Thanks for driving this. I ran the ractor-safe-rails template against an app shaped like ours (Phlex views, PostgreSQL, ~30 common gems) and wanted to share the results as data. They bear on both sides of the “which dependencies are compatible” question above. Setup: Ruby 4.0.7 and Rails main (mid-October). The app is generated from ractor_safe_rails_template.rb (load_defaults 8.2, unshareable_proc_action = :raise) with a Post scaffold, precompiled assets and a dumped db/schema_cache.yml. Each…
R
Hi. I also love this idea. I strongly believe we need an abstraction layer for configuring a Rails app, not only built-in Rails configuration items but also application-specific settings. The Anyway Config gem is a great example that meets the motivation. I think Rails should natively include such a feature to organize application configs and settings, supporting various data sources like config.x, ENV, YAML, etc.
R
camimirabal: Speaking at the event: Vladimir Dementyev (Evil Martians) Chris Oliver (GoRails) Rosa Gutiérrez (37signals) Marco Roth (Herb) Jason Thomas (COSMOS) Irina Nazarova (Evil Martians) … and many more. Day 1 is all about AI, Day 2 covers queues, concurrency and open source, and Day 3 is a community day run by you. You’ll meet engineers and founders from companies like Persona (actively hiring), Gusto, Typensense, Handshake, Apple, Cisco, Anthropic, Fin, AWS,IFTTT, Workday, Zendesk,…
R
Hey all, Ranges on single-mapping composed_of aggregates were fixed in https://github.com/rails/rails/pull/59013, so a value object that maps to one column now works: Customer.where(balance: Money.new(150)..Money.new(250)) # => balance BETWEEN 150 AND 250 I left out composite aggregates deliberately and wanted to discuss how they should be handled. What happens now With a value object spread over more than one column, scalar and array conditions work but a range raises: class Ingredient <…
R
We’re less than a month away from the conference and the time to get tickets is now. Speaking at the event: Vladimir Dementyev (Evil Martians) Chris Oliver (GoRails) Rosa Gutiérrez (37signals) Marco Roth (Herb) Jason Thomas (COSMOS) Irina Nazarova (Evil Martians) … and many more. Day 1 is all about AI, Day 2 covers queues, concurrency and open source, and Day 3 is a community day run by you. You’ll meet engineers and founders from companies like Persona (actively hiring), Gusto, Typensense,…
R
Hi Rails Core team, I’ve been developing TransactionGuard, a Ruby gem that detects external side effects performed inside Active Record transactions. For example, sending an HTTP request, delivering an email, or enqueueing a background job inside a transaction can create inconsistencies if the database transaction later rolls back. The external operation cannot automatically be rolled back with the database changes. TransactionGuard currently provides detection for HTTP requests, email…
R
That’s a question I haven’t really thought about. Mostly the schema has been added to over time, not really horsed around with. So older order items might be missing some keys. Haven’t actually looked at what would happen then. Lonely operators all around, I guess! Walter
R
That’s a great point! Keeping a snapshot of product details with each order makes a lot of sense, especially when products are deleted or updated later. I also like the idea of storing associated attributes as JSON to preserve the original order history. How do you handle schema changes when the product data structure evolves over time?
R
Another thing to consider in your audit trail: products come and go. If all you store is an SKU or a foreign key in the order_items, then you have no path back to “what was that product named?” It is tempting to have a place for everything, and everything in its place. But duplication is cheap, and will save future you. A more general-purpose way to handle this is gems like Audited or PaperTrail, which allow you to save all kinds of ephemera as it happens. They have their own set of problems…