We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
rails changelog
Here's the latest scoop on our updates and improvements! We've been busy making things smoother, faster, and more intuitive for our beloved developers. Check out the exciting changes below:
-
New feature: 🚀 We've jazzed up the Rails console by automatically loading routes when you start it up. No more fumbling around trying to find route helpers—everything's ready and waiting for you right from the get-go! This little tweak means you can now access route methods instantly, making your development process as smooth as butter.
-
Improvement: 🛠️ Our devcontainer script now plays nicely with Podman, giving you the freedom to choose your preferred container management tool. Whether you're a Docker devotee or a Podman pro, our script's got you covered, ensuring seamless development environments either way.
-
Improvement: ⚡ We've turbocharged the
IsolatedExecutionState#state
methods, making them lightning-fast! Thanks to some nifty micro-optimizations, these methods now run up to 94% faster, especially without YJIT. Your Rails applications just got a major speed boost! -
Improvement: 🔍 We've tidied up the method checks by ensuring consistent interfaces for internal objects. This results in cleaner, more readable code, particularly in the ActiveRecord library, making it easier to maintain and understand.
-
Bugfix: 🐛 We've squashed a pesky bug affecting Active Record connections during test parallelization on MacOS. By clearing connections before forking, we've ensured a stable and reliable test environment, especially for those using the mysql2 adapter.
-
Bugfix: 🔧 Active Record's async feature now plays nice with threads! We've fixed an issue that could prevent notifications from firing due to a race condition, ensuring your instrumentation remains consistent and reliable.
-
Bugfix: 🔄 We've fixed the
rotate(on_on_rotation:)
and#on_rotation
methods, so they now properly handle theon_rotation
callback. This improvement enhances the flexibility ofMessageVerifier
andMessageEncryptor
, making message rotation smoother than ever. -
Chore: 🧹 We've cleaned up the API by removing the
rotate(on_rotation:)
argument, which wasn't meant to be publicly exposed. This refinement ensures a more streamlined and intuitive API for everyone.
These updates are all about making your development experience more efficient, reliable, and enjoyable. Happy coding! 😊
Included Commits
This commit addresses a thread safety issue in Active Record's instrumentation when utilizing the async feature. Specifically, it highlights a problem where the subscription to the "active_record.sql" notifications might not trigger due to a race condition that occurs when the instrumentation instance variable on the connection is temporarily overridden. As a result, when executing Post.count_async
, the associated notification may fail to fire, leading to potential inconsistencies in tracking SQL queries.
To resolve this issue, the commit introduces changes that ensure the instrumentation mechanism functions correctly in a multi-threaded environment, thereby maintaining the integrity and reliability of notifications related to Active Record operations. This improvement enhances the robustness of Active Record's async capabilities, ensuring that developers can rely on accurate instrumentation even under concurrent execution scenarios.
Files changed
This commit addresses issues with the rotate(on_on_rotation:)
and #on_rotation
methods in the Rails framework, specifically for the MessageVerifier
and MessageEncryptor
classes. The intention behind these methods is to allow users to provide an on_rotation
callback that can be triggered during the rotation process, which is particularly beneficial for codecs that are generated by the framework, such as ActiveRecord::Base.signed_id_verifier
.
The changes made in this commit ensure that the #rotate
method and the #on_rotation
method properly accept and utilize the on_rotation
callback, enhancing the functionality and flexibility of these components. This improvement resolves the related issue documented in the Rails GitHub repository, thereby streamlining the handling of message rotation in the framework.
Files changed
The recent commit removes the rotate(on_rotation:)
argument from the codebase, clarifying that it was not intended to be part of the public API. This change is a follow-up to a previous pull request, indicating a refinement in the API design for better consistency and usability.
By eliminating this argument, the commit aims to streamline the functionality and prevent potential confusion among developers using the Rails framework. Overall, this adjustment reflects a commitment to maintaining a clean and intuitive API.
Files changed
This commit addresses an issue related to Active Record (AR) connections in tests when running in parallel, specifically fixing a problem that affects the mysql2 adapter on MacOS. The issue, identified in GitHub issue #41176, stems from the behavior of the mysql8 client library on MacOS, which utilizes kqueue and creates a file descriptor (FD) that does not transfer to child processes during forking. This can lead to the FD being reused incorrectly, causing connection problems.
To resolve this, the commit introduces a mechanism to clear AR connections before forking, ensuring that the test environment remains stable and functional during parallel execution. The solution was co-authored by Donal McBreen and is aimed at improving the reliability of tests that depend on the mysql2 adapter in a MacOS environment.
Files changed
The recent commit enhances the functionality of the devcontainer script by enabling compatibility with Podman, a popular container management tool. This update allows developers to utilize Podman as an alternative to Docker for managing development environments, thereby increasing flexibility in container orchestration.
The changes implemented in this commit include modifications to the script to detect and configure Podman appropriately, ensuring that all necessary commands and processes function seamlessly within a Podman context. This improvement aims to streamline the development workflow for users who prefer or require Podman over Docker, broadening the accessibility of the development container setup.
Files changed
This commit introduces a feature that loads the application's routes when starting a Rails console. Previously, when developers opened a console session, the routes were not preloaded, leading to an inability to access route helpers. For example, running a command to list available route methods would return an empty array, making it difficult for developers to utilize route helpers effectively.
With this update, the console now loads the routes upon startup, allowing developers to immediately access route helpers without any additional steps. This enhancement streamlines the development process by enabling quick access to route methods, improving overall productivity when working within the console environment.
Files changed
The recent commit focuses on simplifying method checks by ensuring that all objects used within a specific method adhere to a consistent interface, rather than verifying if internal objects respond to particular methods. This change primarily affects the quote_default_expression
method in the ActiveRecord library, where the previous check for fetch_cast_type
has been removed. Instead, it directly calls fetch_cast_type
on the column
, assuming that all objects will implement this method. This approach enhances code clarity and reduces unnecessary conditionals.
Additionally, the commit introduces a new method, quote_default_expression_for_column_definition
, which streamlines the process of quoting default expressions for column definitions. It assigns the cast_type
to the column definition and calls the updated quoting method. Other modifications include updates to the ColumnDefinition
struct to accommodate a new cast_type
attribute and the addition of a fetch_cast_type
method. These changes collectively aim to improve the overall maintainability and readability of the ActiveRecord codebase.
Files changed
- activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
- activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb
- activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
- activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb
This commit focuses on optimizing the IsolatedExecutionState#state
methods within the Rails framework, which have been identified as significant bottlenecks in performance benchmarks. The optimizations lead to notable improvements in execution speed, particularly when using the YJIT (Yet another Just-in-Time compiler). Benchmark results indicate that the optimized method is approximately 21% faster with YJIT enabled, achieving around 3.28 million iterations per second compared to the original's 2.72 million. Without YJIT, the optimization yields an even more impressive 94% speed increase, with the optimized method reaching about 2.60 million iterations per second.
Overall, these changes are aimed at enhancing the performance of Rails applications by refining a critical area of execution state management. The benchmarks demonstrate the effectiveness of the optimizations, making it a valuable update for developers seeking to improve the efficiency of their Rails applications.