rails changelog


Here's a roundup of the latest tweaks and twirls to our codebase! We've been busy bees, buzzing around to make things smoother, shinier, and downright delightful. Let's dive into the goodies:

New Features ✨

  • Assert in Body Magic: Say hello to assert_in_body and assert_not_in_body! These nifty little methods let you check for text in your HTTP response body without fussing over complex DOM operations. Plus, they come with text escaping to dodge any regex mishaps. Testing just got a whole lot snappier!

  • Database Reset Button: Introducing the --reset option in bin/setup. Now you can easily wipe your database clean and reload seed data during development. It's like having a magic wand to reset your project to its initial state without breaking a sweat!

Improvements 🚀

  • Schema Cache Consistency: We've sorted schema cache columns and indexes per table during dumping. This makes the output consistent, perfect for generating cache keys based on the schema's digest. Your caching game just leveled up!

  • SQL Connection Efficiency: We've streamlined the #arel method by passing the existing connection, cutting down on unnecessary lookups when generating SQL for a Relation. This tweak also lets {update, delete}_all methods use #arel, boosting performance by avoiding redundant AST rebuilds.

  • GROUP BY Optimization: No more recalculating GROUP BY values in {update, delete}_all methods. We're using pre-calculated values, which means smoother operations and the ability to cache the Arel AST. Your database queries just got a speed boost!

Bugfixes 🐛

  • Link Love in Guides: Fixed broken links to the Ruby on Rails blog in the Guides. They now lead you straight to the new site without detours. No more dead ends!

  • Composite Primary Keys Guide: Corrected a link in the Composite Primary Keys guide, ensuring you can easily access the documentation you need. Knowledge is power, after all!

  • Trailing Slash Trouble: Removed a pesky trailing slash from a broken link in the upgrade documentation. Now it takes you exactly where you need to go, no fuss, no muss!

We hope these updates make your development journey a bit more magical! Keep coding and keep smiling! 😄

Included Commits

2025-04-18T16:03:33 See commit

This commit optimizes the handling of GROUP BY clauses in the update_all and delete_all methods of Active Record. Previously, the code recalculated the GROUP BY values by calling arel_columns after building the Arel relation, which could potentially modify the relation and prevent caching of the built Arel AST. By leveraging the already calculated GROUP BY values during the construction of the SelectManager, the commit eliminates unnecessary recalculations and enables caching of the Arel AST, improving performance.

The changes involve removing the recalculation of group_values_arel_columns in both the update_all and delete_all methods, and instead, directly using the groups from the context (@ctx.groups) when compiling the update and delete statements. This adjustment ensures that the SQL generated does not wrap its arguments in unnecessary Group nodes, streamlining the query generation process and enhancing efficiency in database operations.

Files changed

  • activerecord/lib/active_record/relation.rb
  • activerecord/lib/arel/crud.rb
2025-04-18T17:23:44 See commit

The commit introduces a modification to the #arel method by passing the existing database connection, which streamlines the process of generating SQL for a Relation. This change eliminates the need for an additional connection lookup, enhancing efficiency when manually creating SQL queries.

Furthermore, by incorporating a connection parameter into the #arel method, the {update, delete}_all methods can now utilize #arel instead of relying on #build_arel. This adjustment prevents the need to rebuild the Arel Abstract Syntax Tree (AST) when a relation is reused for querying after performing update or delete operations, thus improving performance and reducing overhead in these scenarios.

Files changed

2025-04-19T07:42:36 See commit

This commit introduces two new assertion methods, assert_in_body and assert_not_in_body, to the ActionPack testing framework. These methods simplify the process of checking whether specific text is present or absent in the response body of HTTP requests, avoiding the need for more complex DOM operations. The implementation includes text escaping to prevent unintended interactions with regular expressions, enhancing reliability in text matching.

Additionally, the commit updates the CHANGELOG to document these new features and ensures code quality by addressing Rubocop warnings. Tests have also been added to verify the functionality of the new assertion methods, ensuring that they work correctly in different scenarios. Overall, this enhancement streamlines response body testing, making it more efficient for developers.

Files changed

  • actionpack/CHANGELOG.md
  • actionpack/lib/action_dispatch/testing/assertions/response.rb
  • actionpack/test/controller/action_pack_assertions_test.rb
2025-04-21T13:53:45 See commit

The commit introduces a new --reset option to the bin/setup script, streamlining the process of resetting a database and loading seed data during development. This enhancement allows developers to easily clear their database and repopulate it with initial data, improving the setup experience when starting a new project or working on existing ones.

Key changes include an update to the CHANGELOG.md to document the addition of the --reset option, and modifications to the bin/setup script itself, which now includes a call to db:reset when the --reset argument is provided. This change aims to facilitate a more efficient development workflow by automating the database preparation process.

Files changed

  • railties/CHANGELOG.md
  • railties/lib/rails/generators/rails/app/templates/bin/setup.tt
2025-04-21T22:47:01 See commit

This commit addresses the issue of broken links to the Ruby on Rails blog found in the Guides documentation. The links have been updated to reflect the blog's new location at https://rubyonrails.org/, as the previous URLs no longer redirect to the new site.

By making these changes, the commit ensures that users can access the relevant blog content without encountering dead links, thereby improving the overall usability and accessibility of the Guides. The "ci skip" tag indicates that this change does not require a continuous integration build.

Files changed

2025-04-22T08:04:29 See commit

This commit addresses an issue with a broken link in the documentation for upgrading Ruby on Rails. The link previously ended with a trailing slash, which caused it to malfunction. The modification involved removing the trailing slash to ensure the link directs users correctly to the intended post on the Rails blog.

In addition to fixing the link, the commit includes minor changes in the surrounding text for clarity. The documentation now properly guides users to more information on the PATCH method and its significance in the context of HTTP methods for updates, enhancing the overall user experience for those referencing the guide.

Files changed

  • guides/source/upgrading_ruby_on_rails.md
2025-04-23T11:00:33 See commit

The commit addresses an issue with the documentation for Composite Primary Keys by correcting a link that was previously broken or inaccurate. This update ensures that users can easily access the relevant documentation, improving the overall usability and reliability of the guide.

By fixing the link, the commit enhances the user experience for developers and database administrators seeking information on Composite Primary Keys, making it easier for them to find the necessary resources and guidance.

Files changed

2025-04-23T14:52:05 See commit

This commit introduces the sorting of schema cache columns and indexes for each table during the dumping process in Rails. By implementing this change, the output becomes consistent, which is particularly beneficial for generating cache keys based on the schema's digest. This consistency helps improve the reliability of caching mechanisms in applications using Rails.

The changes ensure that the order of columns and indexes is standardized, which can prevent discrepancies that may arise from varying orders in different environments or database states. This enhancement not only promotes better cache management but also aligns with the ongoing efforts to streamline and optimize the Rails framework.

Files changed