rails changelog


Here's a delightful rundown of the latest and greatest updates that are sure to make your development experience even more awesome! 🎉

  • Improvement: Preserve Duplicate Columns in ActiveRecord::Base#select 🚀
    We've jazzed up the ActiveRecord::Base#select method to keep those duplicate columns intact! Previously, duplicates were lost in the shuffle, but now you can enjoy the full dataset as intended. This makes querying more flexible, especially in complex joins or aggregate functions. Say hello to smoother data retrieval!

  • Improvement: Use WeakKeyMap for Connection Lease Registry 🧠
    Thanks to Ruby 3.3.5, we can now safely use WeakKeyMap for the connection lease registry. This change optimizes memory management by auto-removing entries when keys are no longer needed. It's a nifty follow-up that boosts the efficiency of connection handling in Rails.

  • Improvement: NOT VALID Constraints in create_table 📜
    We've refined how NOT VALID constraints are managed in PostgreSQL schema dumps. By ensuring NOT VALID constraints are dumped as ALTER TABLE statements, we maintain compatibility across different database adapters. This fix resolves issue #53732, ensuring smooth sailing in schema management.

  • Chore: Disable YJIT in Development and Test Environments 🛠️
    To keep things snappy, we've turned off YJIT in development and test environments. Frequent code reloading and method redefining in these environments make YJIT less effective, so disabling it helps prevent unnecessary complexity. Co-authored by Jean Boussier, this tweak keeps your workflow streamlined.

  • Bugfix: Finding by Nil Composite Primary Key Association 🔍
    We've squashed a bug that was causing hiccups when retrieving records with a nil composite primary key. Now, handling such cases is a breeze, improving the reliability of data fetching and ensuring your app runs smoothly.

  • Bugfix: Correct Order of to_prepare Initialization Event 📚
    We've updated the documentation to reflect the correct sequence of the to_prepare initialization event. This fix, addressing issue #53682, enhances clarity and reliability for developers, ensuring everyone is on the same page.

  • Bugfix: Example Code for Request-Based Constraints ✏️
    We've polished the example code for Request-Based Constraints, making it more streamlined and easier to understand. By simplifying the structure, we've improved clarity, so implementing subdomain constraints is now a walk in the park!

Enjoy these updates and happy coding! 🥳

Included Commits

2024-11-22T11:29:05 See commit

The commit addresses an issue related to the retrieval of records using a nil composite primary key association. It implements a fix that ensures the system can correctly identify and handle cases where the composite primary key is not provided, thereby preventing errors and improving the reliability of data fetching operations.

Additionally, the changes likely include updates to the underlying logic that governs how associations are managed in the database, ensuring that nil values are appropriately accounted for in queries and associations. This enhancement aims to streamline data interactions and enhance overall application stability.

Files changed

2024-11-23T10:07:50 See commit

The recent commit enhances the ActiveRecord::Base#select method by preserving duplicate columns in the selection process. Previously, when multiple identical column names were specified in a query, only the first occurrence would be retained, potentially leading to data loss or unexpected behavior. This update ensures that all specified duplicate columns are included in the result set, allowing developers to work with the full dataset as intended.

By maintaining duplicates, the commit improves the flexibility of querying in ActiveRecord, enabling developers to handle scenarios where the same column might be needed multiple times, such as in complex joins or when performing aggregate functions. This change is expected to streamline data retrieval and enhance the overall usability of the ActiveRecord querying interface.

Files changed

2024-11-25T17:25:57 See commit

This commit addresses the handling of NOT VALID constraints in PostgreSQL during the database schema dumping process. It clarifies that while FOREIGN KEY constraints are not included in the create_table statements, CHECK constraints, which are supported by all database adapters, will only dump NOT VALID constraints as ALTER TABLE statements. This approach ensures that the PostgreSQL-specific NOT VALID option does not impact the behavior of other database adapters, maintaining compatibility across different systems.

The change resolves issue #53732 by ensuring that NOT VALID constraints are appropriately managed during schema dumps, thereby preventing potential conflicts and ensuring that the ALTER TABLE options are restored correctly. This improvement enhances the overall functionality and reliability of the schema management process in PostgreSQL.

Files changed

2024-11-26T09:09:31 See commit

This commit disables the YJIT (Yet another Just-In-Time Compiler) feature in development and test environments. The rationale behind this decision is that these environments often involve frequent code reloading and method redefining, such as during mocking, which diminishes the performance benefits that YJIT typically provides. As a result, enabling YJIT in these contexts is not generally advantageous.

The commit was co-authored by Jean Boussier and aims to streamline the development process by preventing unnecessary complexity and potential slowdowns associated with YJIT in scenarios where its optimizations are not effectively utilized.

Files changed

2024-11-26T11:57:07 See commit

This commit introduces the use of WeakKeyMap for the connection lease registry in the Rails framework, addressing a previous limitation due to a bug in WeakKeyMap that could crash the Ruby VM. With the release of Ruby version 3.3.5, the functionality is now stable and safe to implement.

The change enhances the connection lease registry by leveraging the properties of WeakKeyMap, which allows for more efficient memory management by automatically removing entries when their keys are no longer in use. This update is a follow-up to a prior pull request and marks a significant improvement in the handling of connection leases within the Rails application.

Files changed

2024-11-27T07:38:20 See commit

The commit addresses an issue related to the documented order of the to_prepare initialization event in the codebase, specifically fixing a problem identified in issue #53682. The update ensures that the documentation accurately reflects the correct sequence in which the to_prepare event is triggered during the initialization process.

By clarifying the order of operations, this change aims to enhance the understanding and usability of the event for developers, thereby improving the overall quality and reliability of the documentation associated with the initialization events.

Files changed

2024-11-27T15:13:42 See commit

The recent commit addresses an issue in the example code for Request-Based Constraints within the routing documentation. Specifically, it modifies the code snippet by simplifying the structure of the namespace for the admin subdomain, removing unnecessary lines to enhance clarity and readability.

In the updated example, the namespace :admin block has been removed, allowing the constraints block to directly encompass the resources :photos declaration. This change streamlines the example, making it easier for users to understand how to implement subdomain constraints in their routing configurations. Overall, the commit improves the documentation by providing a more concise and effective illustration of the concept.

Files changed

  • guides/source/routing.md