rails changelog


Hey there, awesome developers! Here's a fresh batch of updates and improvements to make your coding life a little bit easier and a lot more fun! 🎉

  • New feature: Date and Time Flexibility in TimeHelpers! 🕰️ You can now pass in a specific date or time to ActiveSupport::Testing::TimeHelpers#freeze_time. This nifty improvement gives you the power to simulate different time scenarios with ease, making your tests more accurate and flexible. Perfect for those time-traveling apps!

  • New feature: Dev Containers Without VSCode! 🚀 Say goodbye to the VSCode dependency! A new script lets you use development containers straight from the command line. Just run a few commands, and you're all set to code in your preferred environment. Command-line warriors, rejoice!

  • Bugfix: Encoding Compatibility for MessageVerifier! 🔒 Upgrading Rails? We've got your back! The AS::MessageVerifier#verify method now accepts both safe and unsafe encoding, making your transition from Rails 7.1 to 7.2 smoother than ever. No more broken IDs!

  • Bugfix: JSON Serialization with ColumnSerializer! 🗃️ Fixed an issue with JSON serialization for hash types by wrapping the coder in ColumnSerializer. Now your data is serialized and deserialized like a charm, ensuring consistency and reliability in your Rails apps.

  • Improvement: Eager Loading Log Clarity! 📋 Eager loading just got more transparent! The payload[:name] attribute now includes the model's name, followed by "Eager Load". This makes your logs more readable and helps you track what's happening under the hood.

  • Bugfix: Stop Invalid Records in Their Tracks! 🚫 We've tightened up validations to prevent invalid records from sneaking through when saving associations. Now, all changed records in the association chain are validated, ensuring data integrity across the board.

  • Improvement: ArgumentError for Non-Exceptions! ⚠️ Rails.error.report method now raises an ArgumentError if you try to report something that's not an exception. This ensures only valid exceptions are reported, keeping your error handling sharp and on point.

  • Chore: Environment Name Update! 🛠️ Updated the environment label from "production" to "development" in the guide to keep everything clear and aligned with development practices. No more mix-ups!

Enjoy these updates, and happy coding! Keep those bugs at bay and those features rolling in! 🚀💻

Included Commits

2025-01-17T00:14:35 See commit

This commit addresses an issue related to the persistence of invalid records within associations in a database, specifically fixing the problem highlighted in issue #54267. Previously, when saving a record along with its associations, the system allowed the operation to proceed even if there were existing invalid records in the database, as seen in the prior commit #53951. This approach inadvertently halted the validation process for subsequent related records, leading to scenarios where invalid changes could be saved without proper checks.

To rectify this, the commit introduces a mechanism that ensures all changed records within the entire association chain are validated before any save operation is completed. This means that if there are any validation errors present in the modified records of the association hierarchy—such as a computer linked to a company—the save operation will be prevented, thereby maintaining data integrity across the relationships.

Files changed

2025-01-17T09:48:13 See commit

This commit modifies the logging output for eager loading in Active Record by changing the format of the payload[:name] attribute. Specifically, it updates the value to include the model's name followed by "Eager Load", resulting in a clearer and more informative log message. This enhancement aims to improve the readability of logs related to eager loading operations, making it easier for developers to understand which models are being eagerly loaded during database interactions.

The change enhances the debugging and monitoring experience by providing more context in the logs, which can be particularly useful when analyzing performance issues or tracking database queries in applications that utilize Active Record for data management. Overall, this commit contributes to better log clarity and aids in the development process.

Files changed

2025-01-17T23:43:17 See commit

This commit introduces a new script that allows users to utilize development containers without relying on Visual Studio Code. The script reads the configuration from the .devcontainer/devcontainer.json file and executes corresponding Docker commands to set up and interact with the development environment. Users can start the container by running tool/devcontainer up, followed by tool/devcontainer run-user-commands to ensure that dependencies are installed and the database is initialized. Finally, users can access a shell within the container using tool/devcontainer sh.

The script processes the JSON configuration to extract necessary information, such as the workspace folder and environment variables, and then executes Docker commands accordingly. It effectively allows developers who prefer not to use VSCode to manage their development environments seamlessly through the command line. The changes include the addition of a new Ruby script located in the tools/devcontainer directory, comprising 30 lines of code with no deletions.

Files changed

  • tools/devcontainer
2025-01-20T09:22:30 See commit

The recent commit enhances the functionality of ActiveSupport::Testing::TimeHelpers#freeze_time by allowing users to pass in a specific date or time when freezing time during tests. This improvement provides greater flexibility for developers, enabling them to simulate various time scenarios more easily and accurately within their test suites.

By incorporating this feature, the testing framework streamlines the process of manipulating time, making it more intuitive for developers to set up their test environments. This addition is particularly useful for testing time-dependent code, as it allows for precise control over the temporal context without altering the existing behavior of the method.

Files changed

2025-01-21T11:07:22 See commit

This commit addresses a significant issue encountered during the upgrade from Rails 7.1 to 7.2, particularly for users relying on Active Record's find_signed feature. The upgrade introduced a change in the MessageVerifier's encoding method, switching from regular Base64 to URL-safe Base64 encoding, which rendered previously generated IDs incompatible. To facilitate a smoother transition for developers, the commit modifies the behavior of the AS::MessageVerifier#verify method, ensuring that both safe and unsafe encoding methods are accepted for decoding, while the url_safe option now solely determines the encoding method used for message generation.

The changes aim to alleviate the complications arising from the encoding switch, allowing existing IDs to remain valid during the upgrade process. The commit was co-authored by Ali Sepehri and Florent Beaurain, reflecting collaborative efforts to enhance the framework's usability and maintain backward compatibility.

Files changed

2025-01-21T13:30:11 See commit

The recent commit addresses an issue with the serialization of data in Rails when using the serialize method with the coder: JSON and type: Hash options. Specifically, it wraps the coder in a ColumnSerializer, which enhances the handling of JSON serialization for hash types. This fix resolves a problem highlighted in issue #54311 on the Rails GitHub repository, ensuring that data is correctly serialized and deserialized when using these options.

By implementing this change, the commit improves the robustness of the serialization process, preventing potential errors and inconsistencies when working with JSON data in hash format. This enhancement contributes to the overall reliability and functionality of the Rails framework, particularly for developers utilizing JSON serialization in their applications.

Files changed

2025-01-22T04:53:12 See commit

The commit primarily focuses on updating the environment designation within the project's documentation. It changes the environment label from "production" to "development" in the relevant section of the guide, ensuring clarity and accuracy for users working in a development context.

This adjustment is crucial for preventing confusion among developers and contributors, as it clearly delineates the intended environment for testing and development activities. Overall, the change enhances the usability of the guide by aligning the documentation with the actual development practices.

Files changed

2025-01-22T19:34:13 See commit

This commit enhances the error reporting functionality in Rails by introducing an ArgumentError when the Rails.error.report method is called with an argument that is not an instance of Exception. The change ensures that only valid exceptions are reported, thereby improving error handling and preventing potential issues that could arise from reporting non-exception objects. The new code checks the type of the argument and raises a descriptive error message if it is not an exception.

Additionally, the commit includes corresponding tests that verify this new behavior. Two tests are added to confirm that an ArgumentError is raised when an object that is neither an exception nor a string is passed to the report method. These tests ensure that the error reporting mechanism behaves as expected, thus enhancing the robustness of the error handling in the Rails framework.

Files changed

  • activesupport/lib/active_support/error_reporter.rb
  • activesupport/test/error_reporter_test.rb