We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
rails changelog
Welcome to the latest update! We've got some cool new features, improvements, and bug fixes that are sure to make your development life a bit easier. Check out the details below! 🚀
New Features
- Basic Sessions Generator Added: 🎉 We've added a basic sessions generator to kickstart your authentication system using database-tracked sessions. This includes models, controllers, views, and migrations for creating users and sessions, along with tests to ensure everything works smoothly. Get ready for effortless user login/logout and session management!
- Script Folder and Generator: 📂 A new default folder for one-off or general-purpose scripts has been added, along with a script generator. Now you can easily create and manage scripts for data migrations, cleanups, and more. Just run
rails generate script my_script
and you're good to go!
Improvements
- Not-Null Modifier in Migrations: 🛠️ We've enhanced the migration process by adding a not-null type modifier. This ensures that certain attributes cannot be null, making your data integrity stronger. Tests are included to verify this new feature.
- Sessions Generator Enhancements: 🔒 Improved how the sessions generator adds
bcrypt
by using Thor'suncomment_lines
instead ofgsub_file
. Ifbcrypt
is missing, it will be added automatically, ensuring a smoother setup process. - Deprecate Constant Improvements: 🔄 Enhanced the
deprecate_constant
function to handle multiple definitions more gracefully. Now, the deprecation warning will only be issued once, even if the constant is defined multiple times.
Bug Fixes
- Deprecate ActiveRecord::ImmutableRelation: 🐛 The
ActiveRecord::ImmutableRelation
class has been deprecated and replaced withActiveRecord::UnmodifiableRelation
. This change includes updates to methods and tests to ensure a smooth transition. - Markdown Table Collapse Fix: 📄 Fixed an issue with the markdown table collapse in the
configuring.md
file. Now, the table collapses correctly, improving readability and usability. - Loaded Relation Batching Fix: 🔄 Fixed a bug with loaded relation batching when limits and reverse order are applied. This ensures that the correct records are returned in the expected order, preventing any inconsistencies.
We hope these updates make your development experience even better. Happy coding! 💻✨
Included Commits
This commit fixes an issue with the markdown table collapse in the configuring.md file. The changes made in this commit address the problem and ensure that the table collapses correctly as intended. This fix improves the readability and usability of the configuring.md file for users.
Overall, this commit resolves a specific issue with the markdown table collapse in the configuring.md file, making it easier for users to navigate and understand the information presented in the document. The changes made in this commit ensure that the table collapses properly, enhancing the overall user experience when accessing and using the configuring.md file.
Files changed
The commit deprecates the ActiveRecord::ImmutableRelation
class and replaces it with ActiveRecord::UnmodifiableRelation
. The changes involve modifying the ActiveRecord::Errors
module to include deprecation warnings for the old class and update references to it in various test cases. Additionally, the assert_mutability!
method in ActiveRecord::Relation::QueryMethods
is renamed to assert_modifiable!
to reflect the new class name.
The commit also includes updates to test cases in errors_test.rb
and relations_test.rb
to ensure that the deprecated ImmutableRelation
class is no longer being used and that the new UnmodifiableRelation
class is being correctly raised in scenarios where mutations are attempted on loaded relations. Overall, the commit streamlines the deprecation process for ActiveRecord::ImmutableRelation
and provides a smoother transition to the new ActiveRecord::UnmodifiableRelation
.
Files changed
- activerecord/lib/active_record/errors.rb
- activerecord/lib/active_record/relation/query_methods.rb
- activerecord/test/cases/errors_test.rb
- activerecord/test/cases/relations_test.rb
This commit fixes an issue with loaded relation batching when limits and reverse order are applied. The issue was causing incorrect results to be returned when querying for related records with limits and reverse order. The fix ensures that the correct records are returned in the expected order when querying for related records with limits and reverse order. This improvement will help to prevent any errors or inconsistencies in the results when using loaded relation batching with limits and reverse order.
Files changed
This commit made improvements to the deprecate_constant function. Specifically, it updated the code to handle cases where the constant being deprecated was being defined multiple times. This change ensures that the deprecation warning is only issued once, even if the constant is defined multiple times within the codebase. Additionally, the commit included updates to the documentation to reflect these improvements and provide clarity on how the function should be used. Overall, these changes aim to enhance the functionality and usability of the deprecate_constant function in the codebase.
Files changed
This commit adds a new script default folder to hold one-off or general purpose scripts, such as data migration scripts and cleanup scripts. It also includes a script generator to create such scripts. The script generator allows users to create scripts by running a command like rails generate script my_script
, which will generate a script file that can be run using ruby script/my_script.rb
. The commit also includes updates to the Rails guides, changelog, and test files related to the addition of the script folder and generator.
Co-authored-by: Haroon Ahmed haroon.ahmed25@gmail.com
Files changed
- guides/source/getting_started.md
- railties/CHANGELOG.md
- railties/lib/rails/generators/rails/app/app_generator.rb
- railties/lib/rails/generators/rails/script/USAGE
- railties/lib/rails/generators/rails/script/script_generator.rb
- railties/lib/rails/generators/rails/script/templates/script.rb.tt
- railties/test/generators/app_generator_test.rb
- railties/test/generators/script_generator_test.rb
This commit adds a new not-null type modifier to migration attributes in Rails. This modifier can be used when generating migrations to specify that certain attributes should not allow null values. For example, when generating a migration to create a table for users, the modifier can be used to ensure that the email_address and password_digest attributes are not nullable. This change also includes updates to the script folder and generator, as well as modifications to the generated_attribute.rb file to handle the new type modifier.
Additionally, this commit includes tests for creating table migrations with required attributes and adding migrations with required attributes. These tests ensure that the not-null modifier is correctly applied when generating migrations for tables and adding columns to existing tables. Overall, this commit enhances the functionality of migrations in Rails by providing a way to specify not-null attributes during the migration generation process.
Files changed
- railties/CHANGELOG.md
- railties/lib/rails/generators/generated_attribute.rb
- railties/test/generators/migration_generator_test.rb
This commit adds a basic sessions generator to provide a starting point for an authentication system using database-tracked sessions. It includes the generation of various files such as models for sessions, users, and current attributes, a sessions controller, views for sessions, and migrations for creating users and sessions. The generator also includes functionality for authentication, session management, and user login/logout.
Additionally, the commit includes tests for the sessions generator to ensure that the generated files and configurations are correct. It also updates the CHANGELOG to reflect the addition of the sessions generator. The generator provides a simple way to set up authentication functionality in a Rails application, including user authentication, session management, and user login/logout features.
Files changed
- railties/CHANGELOG.md
- railties/lib/rails/generators/rails/sessions/USAGE
- railties/lib/rails/generators/rails/sessions/sessions_generator.rb
- railties/lib/rails/generators/rails/sessions/templates/controllers/concerns/authentication.rb
- railties/lib/rails/generators/rails/sessions/templates/controllers/sessions_controller.rb
- railties/lib/rails/generators/rails/sessions/templates/models/current.rb
- railties/lib/rails/generators/rails/sessions/templates/models/session.rb
- railties/lib/rails/generators/rails/sessions/templates/models/user.rb
- railties/lib/rails/generators/rails/sessions/templates/views/sessions/new.html.erb
- railties/test/generators/sessions_generator_test.rb
This commit improves how the sessions generator adds bcrypt
by using Thor's uncomment_lines
instead of gsub_file
. If the Gemfile does not contain bcrypt
, either commented or uncommented, then the command bundle add bcrypt
is run. Additionally, all bundler commands are now run within Bundler.with_original_env
to avoid resolution problems with bundler dependencies, which could result in errors like "Could not find bcrypt-3.1.20 in cached gems or installed locally (Bundler::GemNotFound)".
The changes made in this commit include fixing the CHANGELOG message for the sessions generator and updating the sessions generator to add bcrypt
more robustly. The modifications in the code ensure that the process of adding bcrypt
is more resilient and less prone to errors, especially when dealing with bundler dependencies. By utilizing Thor's uncomment_lines
and running bundler commands within Bundler.with_original_env
, the sessions generator now handles the addition of bcrypt
more efficiently and reliably.
Files changed
- railties/CHANGELOG.md
- railties/lib/rails/generators/rails/sessions/sessions_generator.rb