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 from our recent updates! ๐
### New Features
- **Authentication generator supports an `--api` flag**: ๐ Now you can generate API-only controllers and models without view templates, making your API-centric projects leaner and meaner. Plus, the sessions view template is now in an ERB generator, so gems like `tailwindcss-rails` can join the party with specialized templates.
- **Docker build warnings become errors**: ๐ ๏ธ We've made Docker builds more robust by generating errors when warnings pop up, ensuring potential issues are addressed early.
- **Add bin/dev by default**: ๐ A uniform way to start dev mode whether you're using jsbundling or importmaps. This makes your development process smoother and more consistent.
- **Add missing `text_area` alias in Action View FormHelper**: ๐ Now you can use `textarea` as an alias for `text_area`, making form creation even more intuitive.
### Bugfixes
- **Session tokens ought not be null**: ๐ We've fixed an issue in the authentication generator to ensure session tokens are never null, improving data integrity.
- **Fix `delegate_missing_to allow_nil: true` with implicit self**: ๐ ๏ธ Improved the robustness of the method, ensuring it handles cases more gracefully without relying on exceptions.
- **Fix some more Rails 7.3 references**: ๐
Updated deprecation warnings to reflect that certain methods will be removed in Rails 8.0, not 7.3.
### Improvements
- **Rename check_box to checkbox**: ๐ For better clarity and consistency, we've renamed `check_box` to `checkbox`. Don't worry, aliases are provided for backward compatibility.
- **ActiveModel human_attribute_name raises error on missing translations**: ๐ Models will now raise errors for missing translations if `config.i18n.raise_on_missing_translations` is set to true, just like controllers and views.
### Chores
- **Get rid of unused AbstractAdapter#log method**: ๐งน Cleaned up the codebase by removing an unused method, making the ActiveRecord library more efficient.
Enjoy the new features and improvements, and happy coding! ๐
Included Commits
This commit updates the deprecation warnings in the Rails framework regarding the read_encrypted_secrets
configuration methods. Specifically, it changes the messages to indicate that these methods are deprecated and will be removed in Rails 8.0, rather than the previously stated Rails 7.3.
The modifications were made in the railties/lib/rails/application/configuration.rb
file, where both the getter and setter methods for read_encrypted_secrets
now reflect the updated deprecation timeline. This change aims to provide clearer guidance to developers about the lifecycle of these methods and to prepare them for the upcoming version of Rails.
Files changed
- railties/lib/rails/application/configuration.rb
This commit modifies the behavior of ActiveModel in Ruby on Rails to ensure that models also raise an error when there are missing translations, aligning them with controllers and views. Previously, while the configuration setting config.i18n.raise_on_missing_translations = true
would trigger errors in controllers and views for missing translations, it did not extend to models. The change aims to provide a more consistent error-handling experience across the framework.
The commit is co-authored by Alex Ghiculescu and Jean Boussier, reflecting collaborative efforts to enhance the robustness of the translation handling in Rails applications.
Files changed
This commit renames the method check_box
to checkbox
in the Rails framework, enhancing clarity and consistency in naming conventions. To ensure backward compatibility, aliases for the old method name are provided, allowing existing codebases to function without immediate changes.
The modifications span several test files, including those for Active Model, form collections, and form helpers, as well as updates to the documentation in the guides. Additionally, changes were made to the generated attribute handling in the Railties library and its associated tests, ensuring that all relevant components are aligned with the new naming convention.
Files changed
- actionview/test/template/active_model_helper_test.rb
- actionview/test/template/form_collections_helper_test.rb
- actionview/test/template/form_helper/form_with_test.rb
- actionview/test/template/form_helper_test.rb
- actionview/test/template/form_tag_helper_test.rb
- guides/source/form_helpers.md
- railties/lib/rails/generators/generated_attribute.rb
- railties/test/generators/generated_attribute_test.rb
This commit addresses an issue with the delegate_missing_to
method in Rails when used with allow_nil: true
and an implicit self context. The previous implementation incorrectly assumed that invoking super
would always result in a NoMethodError
, but it was found that a NameError
could be raised instead if the receiver is an implicit self.
To improve the robustness of the method, the commit modifies the implementation to avoid relying on exceptions for control flow. This change enhances the reliability of the method by ensuring that it handles such cases more gracefully, ultimately leading to better error management and a more predictable behavior in the Rails framework.
Files changed
This commit introduces an enhancement to the authentication generator in Rails by adding an --api
flag, which allows developers to generate API-only controllers and models without any accompanying view templates. This change is particularly useful for applications that do not require traditional HTML views, streamlining the setup process for API-centric projects. The authentication generator now conditionally invokes the template engine based on whether the --api
flag is provided, ensuring a more tailored generation of files according to the application's needs.
Additionally, the sessions view template has been relocated into a dedicated ERB generator, enabling the integration of specialized templates from external gems like tailwindcss-rails. The commit includes updates to the authentication generator's code and tests to verify the functionality of the new --api
option, ensuring that when this flag is used, the relevant model and controller files are still created while omitting the view template. The tests confirm that the generator behaves as expected in both scenarios, providing a robust framework for developers to customize their authentication systems.
Files changed
- railties/lib/rails/generators/erb/authentication/authentication_generator.rb
- railties/lib/rails/generators/rails/authentication/authentication_generator.rb
- railties/test/generators/authentication_generator_test.rb
This commit introduces the bin/dev
file by default in Rails applications, providing a standardized method for starting development mode regardless of whether the project uses JavaScript bundling or import maps. The addition aims to streamline the development process for developers by ensuring that they have a consistent command to initiate their applications.
In addition to creating the bin/dev
file, the commit also modifies several generator tests to include this new file in the default files generated for Rails applications. This ensures that the bin/dev
file is included in the generated application structure, improving the overall developer experience by allowing easier access to development mode functionalities.
Files changed
- railties/lib/rails/generators/rails/app/templates/bin/dev.tt
- railties/test/generators/api_app_generator_test.rb
- railties/test/generators/app_generator_test.rb
- railties/test/generators/plugin_generator_test.rb
This commit removes the unused log
method from the AbstractAdapter
class in the ActiveRecord library. The method, which was designed to instrument SQL queries by logging various parameters such as the SQL statement, name, binds, and connection details, has been eliminated due to its lack of use within the codebase.
The changes involved a total of 17 deletions, streamlining the code by removing unnecessary complexity. By eliminating this method, the commit contributes to cleaner and more maintainable code, enhancing the overall efficiency of the ActiveRecord connection adapters.
Files changed
- activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
This commit introduces a new feature that modifies the behavior of Docker builds by generating errors when warnings are encountered during the build process. This enhancement aims to improve the reliability and quality of Docker images by ensuring that potential issues are addressed before the build completes.
By enforcing stricter error handling, developers are prompted to resolve warnings that could lead to runtime problems, thereby promoting best practices in image creation and maintenance. Overall, this change is expected to lead to more robust and stable Docker deployments.
Files changed
This commit introduces a missing alias for the text_area
method in the Action View FormHelper of the Rails framework. Specifically, it adds an alias for the method textarea
, allowing developers to use text_area
interchangeably. The change is made in the form_helper.rb
file, with a single line addition to create the alias.
Additionally, the commit includes a new test case in form_helper_test.rb
to ensure that the text_area
alias works correctly. The test verifies that when using the text_area
method within a form, it generates the expected HTML output for a textarea element, confirming that the alias functions as intended. This enhancement improves the usability of the FormHelper by providing a more familiar method name for developers.
Files changed
- actionview/lib/action_view/helpers/form_helper.rb
- actionview/test/template/form_helper_test.rb
This commit addresses an issue in the authentication generator of the Rails framework by ensuring that session tokens cannot be null. Specifically, it modifies the migration generation for creating session records to enforce that the token
field is required.
The change involves updating the migration command in the authentication_generator.rb
file, where the token
attribute is now marked with an exclamation mark (token:token!
), indicating that it must have a value. This enhancement improves data integrity by preventing the creation of session records without a valid token.
Files changed
- railties/lib/rails/generators/rails/authentication/authentication_generator.rb