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 and greatest update for our project! Check out the cool new features, important fixes, and some clean-up work we've done to keep everything running smoothly. 🚀
New Features
-
Refactor Code for Clarity: We've refactored the code in
activerecord/lib/arel/visitors/to_sql.rb
to make it more readable and maintainable. The conditional logic has been extracted to a new method calledrequire_parentheses?
, replacing the previouspresent?
calls. This makes the code easier to understand and work with. -
Enhanced
pluck
Method: TheActiveRecord::Base#pluck
method now accepts hash values as arguments! This means you can use column aliases when retrieving specific columns from a database query, giving you more flexibility and customization options.
Bug Fixes
-
Devcontainer Smoke Test for Forked Repos: Fixed an issue with the devcontainer smoke test for forked repositories. Now, the test won't attempt to push devcontainer images if the repo is a fork, preventing permission errors and ensuring smoother workflow runs.
-
remove_prefix_and_suffix
inActiveRecord::SchemaDumper
: Resolved a bug where theremove_prefix_and_suffix
method was broken due to an unusedversion
argument. The method now correctly handles table name prefix and suffix options, restoring its intended functionality. -
Typo in Feature Policy for Idle-Detection: Corrected a typo in the Feature Policy for idle-detection from
idle_detection
toidle-detection
. This fix ensures that browsers can now process the policy correctly, as per MDN documentation.
Improvements
- Documentation Copy Edit: Made some copy edits to the documentation in
activerecord/lib/active_record/associations.rb
, specifically for thehas_many
method. The updates provide clearer guidance on the+:autosave+
option, enhancing readability and accuracy.
Chores
- Remove Unused Variable in Test: Cleaned up the test file for ActiveRecord migration command recorder by removing an unused variable assignment. This makes the code more concise and easier to read without affecting functionality.
That's all for now! Keep coding and stay awesome! 💻✨
Included Commits
This commit fixes a typo in the Feature Policy for idle-detection, correcting the spelling from idle_detection
to idle-detection
. This typo was causing browsers to ignore the policy, as it was not being recognized correctly. The correction ensures that browsers can now process the policy properly and apply it as intended, as outlined in the MDN documentation for idle-detection.
Files changed
This commit enables the ActiveRecord::Base#pluck
method to accept hash values as arguments. Previously, the pluck
method only accepted column names as arguments, but with this change, users can now pass in a hash where the keys are column names and the values are aliases for those columns. This allows for more flexibility and customization when retrieving specific columns from a database query using the pluck
method.
Overall, this update enhances the functionality of the pluck
method in ActiveRecord by allowing users to specify column aliases in addition to column names. This can be particularly useful when working with complex queries or when needing to retrieve specific columns with custom names. The ability to pass in hash values to the pluck
method provides users with more control and options for extracting data from database queries in Rails applications.
Files changed
This commit fixes a bug in the remove_prefix_and_suffix
method in ActiveRecord::SchemaDumper
where the functionality was broken due to the table name prefix and suffix options being assigned to an unused version
argument in the SchemaDumper#initialize
method added in a previous commit. The bug caused the remove_prefix_and_suffix
method to not work properly when trying to remove prefixes and suffixes from table names.
The fix involves updating the remove_prefix_and_suffix
method in ActiveRecord::SchemaDumper
to correctly handle the table name prefix and suffix options. By addressing the issue with the unused version
argument and ensuring that the method properly removes prefixes and suffixes from table names, this commit resolves the bug and restores the functionality of remove_prefix_and_suffix
in ActiveRecord::SchemaDumper
.
Files changed
This commit addresses an issue with the devcontainer smoke test for forked repositories. When running the smoke test on the main branch, devcontainer images are pushed to ghcr for caching purposes. However, this process causes an error on forked repositories due to lack of permission to push. To resolve this, the commit sets the step to never push if the repository is a fork. Since the github context does not have a direct way of checking if a repository is a fork, the commit instead checks the repo owner to determine permission, as it is typically the repo owner (in this case, rails) who has the necessary permissions to push the package.
Overall, the changes made in this commit ensure that the devcontainer smoke test runs smoothly for forked repositories by preventing unnecessary push attempts that would result in errors. By adjusting the push behavior based on whether the repository is a fork or not, the commit improves the workflow for all users, maintaining efficiency and preventing potential issues.
Files changed
This commit removes an unused variable assignment in the test file for ActiveRecord migration command recorder. The variable "x" was assigned in the test_irreversible_commands_raise_exception method but was not used anywhere in the method. The commit simply removes the assignment of "x" and directly calls assert_raises method with the ActiveRecord::IrreversibleMigration argument.
This change does not affect the functionality of the test, but it cleans up the code by removing unnecessary variable assignments, making the code more concise and easier to read. The commit only modifies two lines in the test file, improving the overall code quality and maintainability.
Files changed
- activerecord/test/cases/migration/command_recorder_test.rb
This commit refactors the code in activerecord/lib/arel/visitors/to_sql.rb to make it more clear and readable. The conditional logic that checks for certain conditions in a SelectStatement object is extracted to a separate method called require_parentheses?, which explains what it needs to do. This method replaces the previous calls to present? for checking orders, limit, and offset, making the code more explicit and easier to understand.
The changes in this commit involve modifying the grouping_parentheses method to utilize the new require_parentheses? method instead of calling present? directly on orders, limit, and offset. This results in 5 additions and 1 deletion in the file, with a total of 6 changes made. By refactoring the code in this way, the developer aims to improve the clarity and maintainability of the codebase.
Files changed
- activerecord/lib/arel/visitors/to_sql.rb
In this commit, documentation in the activerecord/lib/active_record/associations.rb file was copy edited. Specifically, changes were made to the has_many method, including clarifications and formatting improvements. The additions and deletions in this commit were 3 and 1 respectively, with a total of 4 changes made to the file. The changes included updating the description of the +:autosave+ option to provide clearer guidance on its functionality when saving the parent object.
Overall, this commit focused on enhancing the readability and accuracy of the documentation related to the has_many method in the ActiveRecord associations.rb file. The changes made aimed to provide better explanations and instructions for developers using this method, particularly in relation to the +:autosave+ option. By improving the clarity of the documentation, this commit contributes to a more user-friendly and informative experience for those working with ActiveRecord associations.
Files changed
- activerecord/lib/active_record/associations.rb