rails 7.0.3
Active Support
- No changes.
Active Model
- No changes.
Active Record
-
Some internal housekeeping on reloads could break custom
respond_to?methods in class objects that referenced reloadable constants. See #44125 for details.Xavier Noria
-
Fixed MariaDB default function support.
Defaults would be written wrong in "db/schema.rb" and not work correctly if using
db:schema:load. Further more the function name would be added as string content when saving new records.kaspernj
-
Fix
remove_foreign_keywith:if_existsoption when foreign key actually exists.fatkodima
-
Remove
--no-commentsflag in structure dumps for PostgreSQLThis broke some apps that used custom schema comments. If you don't want comments in your structure dump, you can use:
ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags = ['--no-comments']Alex Ghiculescu
-
Use the model name as a prefix when filtering encrypted attributes from logs.
For example, when encrypting
Person#nameit will addperson.nameas a filter parameter, instead of justname. This prevents unintended filtering of parameters with a matching name in other models.Jorge Manrubia
-
Fix quoting of
ActiveSupport::DurationandRationalnumbers in the MySQL adapter.Kevin McPhillips
-
Fix
change_column_commentto preserve column's AUTO_INCREMENT in the MySQL adapterfatkodima
Action View
-
Ensure models passed to
form_forattempt to callto_model.Sean Doyle
Action Pack
-
Allow relative redirects when
raise_on_open_redirectsis enabled.Tom Hughes
-
Fix
authenticate_with_http_basicto allow for missing password.Before Rails 7.0 it was possible to handle basic authentication with only a username.
authenticate_with_http_basic do |token, _| ApiClient.authenticate(token) endThis ability is restored.
Jean Boussier
-
Fix
content_security_policyreturning invalid directives.Directives such as
self,unsafe-evaland few others were not single quoted when the directive was the result of calling a lambda returning an array.content_security_policy do |policy| policy.frame_ancestors lambda { [:self, "https://example.com"] } endWith this fix the policy generated from above will now be valid.
Edouard Chin
-
Fix
skip_forgery_protectionto run without raising an error if forgery protection has not been enabled /verify_authenticity_tokenis not a defined callback.This fix prevents the Rails 7.0 Welcome Page (
/) from raising anArgumentErrorifdefault_protect_from_forgeryis false.Brad Trick
-
Fix
ActionController::Liveto copy the IsolatedExecutionState in the ephemeral thread.Since its inception
ActionController::Livehas been copying thread local variables to keep things such asCurrentAttributesset from middlewares working in the controller action.With the introduction of
IsolatedExecutionStatein 7.0, some of that global state was lost inActionController::Livecontrollers.Jean Boussier
-
Fix setting
trailing_slash: truein route definition.get '/test' => "test#index", as: :test, trailing_slash: true test_path() # => "/test/"Jean Boussier
Active Job
-
Add missing
bigdecimalrequire inActiveJob::ArgumentsCould cause
uninitialized constant ActiveJob::Arguments::BigDecimal (NameError)when loading Active Job in isolation.Jean Boussier
Action Mailer
- No changes.
Action Cable
- No changes.
Active Storage
-
Don't stream responses in redirect mode
Previously, both redirect mode and proxy mode streamed their responses which caused a new thread to be created, and could end up leaking connections in the connection pool. But since redirect mode doesn't actually send any data, it doesn't need to be streamed.
Luke Lau
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
-
If reloading and eager loading are both enabled, after a reload Rails eager loads again the application code.
Xavier Noria
-
Use
controller_class_pathinRails::Generators::NamedBase#route_urlThe
route_urlmethod now returns the correct path when generating a namespaced controller with a top-level model using--model-name.Previously, when running this command:
bin/rails generate scaffold_controller Admin/Post --model-name Postthe comments above the controller action would look like:
# GET /posts def index @posts = Post.all endafterwards, they now look like this:
# GET /admin/posts def index @posts = Post.all endFixes #44662.
Andrew White