diff --git a/Gemfile.lock b/Gemfile.lock index 4d6a3eaecc6..8c7e6ea0822 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,70 +20,70 @@ GIT PATH remote: . specs: - actioncable (7.1.0.rc1) - actionpack (= 7.1.0.rc1) - activesupport (= 7.1.0.rc1) + actioncable (7.2.0.alpha) + actionpack (= 7.2.0.alpha) + activesupport (= 7.2.0.alpha) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.0.rc1) - actionpack (= 7.1.0.rc1) - activejob (= 7.1.0.rc1) - activerecord (= 7.1.0.rc1) - activestorage (= 7.1.0.rc1) - activesupport (= 7.1.0.rc1) + actionmailbox (7.2.0.alpha) + actionpack (= 7.2.0.alpha) + activejob (= 7.2.0.alpha) + activerecord (= 7.2.0.alpha) + activestorage (= 7.2.0.alpha) + activesupport (= 7.2.0.alpha) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.0.rc1) - actionpack (= 7.1.0.rc1) - actionview (= 7.1.0.rc1) - activejob (= 7.1.0.rc1) - activesupport (= 7.1.0.rc1) + actionmailer (7.2.0.alpha) + actionpack (= 7.2.0.alpha) + actionview (= 7.2.0.alpha) + activejob (= 7.2.0.alpha) + activesupport (= 7.2.0.alpha) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.0.rc1) - actionview (= 7.1.0.rc1) - activesupport (= 7.1.0.rc1) + actionpack (7.2.0.alpha) + actionview (= 7.2.0.alpha) + activesupport (= 7.2.0.alpha) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.0.rc1) - actionpack (= 7.1.0.rc1) - activerecord (= 7.1.0.rc1) - activestorage (= 7.1.0.rc1) - activesupport (= 7.1.0.rc1) + actiontext (7.2.0.alpha) + actionpack (= 7.2.0.alpha) + activerecord (= 7.2.0.alpha) + activestorage (= 7.2.0.alpha) + activesupport (= 7.2.0.alpha) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.0.rc1) - activesupport (= 7.1.0.rc1) + actionview (7.2.0.alpha) + activesupport (= 7.2.0.alpha) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.0.rc1) - activesupport (= 7.1.0.rc1) + activejob (7.2.0.alpha) + activesupport (= 7.2.0.alpha) globalid (>= 0.3.6) - activemodel (7.1.0.rc1) - activesupport (= 7.1.0.rc1) - activerecord (7.1.0.rc1) - activemodel (= 7.1.0.rc1) - activesupport (= 7.1.0.rc1) + activemodel (7.2.0.alpha) + activesupport (= 7.2.0.alpha) + activerecord (7.2.0.alpha) + activemodel (= 7.2.0.alpha) + activesupport (= 7.2.0.alpha) timeout (>= 0.4.0) - activestorage (7.1.0.rc1) - actionpack (= 7.1.0.rc1) - activejob (= 7.1.0.rc1) - activerecord (= 7.1.0.rc1) - activesupport (= 7.1.0.rc1) + activestorage (7.2.0.alpha) + actionpack (= 7.2.0.alpha) + activejob (= 7.2.0.alpha) + activerecord (= 7.2.0.alpha) + activesupport (= 7.2.0.alpha) marcel (~> 1.0) - activesupport (7.1.0.rc1) + activesupport (7.2.0.alpha) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -93,23 +93,23 @@ PATH minitest (>= 5.1) mutex_m tzinfo (~> 2.0) - rails (7.1.0.rc1) - actioncable (= 7.1.0.rc1) - actionmailbox (= 7.1.0.rc1) - actionmailer (= 7.1.0.rc1) - actionpack (= 7.1.0.rc1) - actiontext (= 7.1.0.rc1) - actionview (= 7.1.0.rc1) - activejob (= 7.1.0.rc1) - activemodel (= 7.1.0.rc1) - activerecord (= 7.1.0.rc1) - activestorage (= 7.1.0.rc1) - activesupport (= 7.1.0.rc1) + rails (7.2.0.alpha) + actioncable (= 7.2.0.alpha) + actionmailbox (= 7.2.0.alpha) + actionmailer (= 7.2.0.alpha) + actionpack (= 7.2.0.alpha) + actiontext (= 7.2.0.alpha) + actionview (= 7.2.0.alpha) + activejob (= 7.2.0.alpha) + activemodel (= 7.2.0.alpha) + activerecord (= 7.2.0.alpha) + activestorage (= 7.2.0.alpha) + activesupport (= 7.2.0.alpha) bundler (>= 1.15.0) - railties (= 7.1.0.rc1) - railties (7.1.0.rc1) - actionpack (= 7.1.0.rc1) - activesupport (= 7.1.0.rc1) + railties (= 7.2.0.alpha) + railties (7.2.0.alpha) + actionpack (= 7.2.0.alpha) + activesupport (= 7.2.0.alpha) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -557,7 +557,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.11) + zeitwerk (2.6.12) PLATFORMS ruby diff --git a/RAILS_VERSION b/RAILS_VERSION index b104ec3500a..2031da2af56 100644 --- a/RAILS_VERSION +++ b/RAILS_VERSION @@ -1 +1 @@ -7.1.0.rc1 +7.2.0.alpha diff --git a/actioncable/CHANGELOG.md b/actioncable/CHANGELOG.md index 5de4305de47..8de6b43a843 100644 --- a/actioncable/CHANGELOG.md +++ b/actioncable/CHANGELOG.md @@ -1,106 +1,2 @@ -## Rails 7.1.0.rc1 (September 27, 2023) ## -* No changes. - - -## Rails 7.1.0.beta1 (September 13, 2023) ## - -* Add a `@server` instance variable referencing the `ActionCable.server` - singleton to `ActionCable::Channel::ConnectionStub` - - This lets us delegate the `pubsub` and `config` method calls - to the server. This fixes `NoMethodError` errors when testing - channel logic that call `pubsub` (e.g. `stop_stream_for`). - - *Julian Foo* - -* Added `health_check_path` and `health_check_application` config to - mount a given health check rack app on a given path. - Useful when mounting Action Cable standalone. - - *Joé Dupuis* - -* Introduce the `capture_broadcasts` test helper. - - Returns all messages broadcast in a block. - - ```ruby - messages = capture_broadcasts("test") do - ActionCable.server.broadcast "test", { message: "one" } - ActionCable.server.broadcast "test", { message: "two" } - end - assert_equal 2, messages.length - assert_equal({ "message" => "one" }, messages.first) - assert_equal({ "message" => "two" }, messages.last) - ``` - - *Alex Ghiculescu* - -* Display broadcasted messages on error message when using `assert_broadcast_on` - - *Stéphane Robino* - -* The Action Cable client now supports subprotocols to allow passing arbitrary data - to the server. - - ```js - const consumer = ActionCable.createConsumer() - - consumer.addSubProtocol('custom-protocol') - - consumer.connect() - ``` - - See also: - - * https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#subprotocols - - *Guillaume Hain* - -* Redis pub/sub adapter now automatically reconnects when Redis connection is lost. - - *Vladimir Dementyev* - -* The `connected()` callback can now take a `{reconnected}` parameter to differentiate - connections from reconnections. - - ```js - import consumer from "./consumer" - - consumer.subscriptions.create("ExampleChannel", { - connected({reconnected}) { - if (reconnected) { - ... - } else { - ... - } - } - }) - ``` - - *Mansa Keïta* - -* The Redis adapter is now compatible with redis-rb 5.0 - - Compatibility with redis-rb 3.x was dropped. - - *Jean Boussier* - -* The Action Cable server is now mounted with `anchor: true`. - - This means that routes that also start with `/cable` will no longer clash with Action Cable. - - *Alex Ghiculescu* - -* `ActionCable.server.remote_connections.where(...).disconnect` now sends `disconnect` message - before closing the connection with the reconnection strategy specified (defaults to `true`). - - *Vladimir Dementyev* - -* Added command callbacks to `ActionCable::Connection::Base`. - - Now you can define `before_command`, `after_command`, and `around_command` to be invoked before, after or around any command received by a client respectively. - - *Vladimir Dementyev* - -Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actioncable/CHANGELOG.md) for previous changes. +Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actioncable/CHANGELOG.md) for previous changes. diff --git a/actioncable/lib/action_cable/gem_version.rb b/actioncable/lib/action_cable/gem_version.rb index 4f24ace97cc..f1e674f4da7 100644 --- a/actioncable/lib/action_cable/gem_version.rb +++ b/actioncable/lib/action_cable/gem_version.rb @@ -8,9 +8,9 @@ module ActionCable module VERSION MAJOR = 7 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "rc1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/actioncable/package.json b/actioncable/package.json index 0baa394d91d..fa95b242757 100644 --- a/actioncable/package.json +++ b/actioncable/package.json @@ -1,6 +1,6 @@ { "name": "@rails/actioncable", - "version": "7.1.0-rc1", + "version": "7.2.0-alpha", "description": "WebSocket framework for Ruby on Rails.", "module": "app/assets/javascripts/actioncable.esm.js", "main": "app/assets/javascripts/actioncable.js", diff --git a/actionmailbox/CHANGELOG.md b/actionmailbox/CHANGELOG.md index cf34b62ebca..56638356a0f 100644 --- a/actionmailbox/CHANGELOG.md +++ b/actionmailbox/CHANGELOG.md @@ -1,26 +1,2 @@ -## Rails 7.1.0.rc1 (September 27, 2023) ## -* No changes. - - -## Rails 7.1.0.beta1 (September 13, 2023) ## - -* Added `bounce_now_with` to send the bounce email without going through a mailer queue. - - *Ronan Limon Duparcmeur* - -* Support configured primary key types in generated migrations. - - *Nishiki Liu* - -* Fixed ingress controllers' ability to accept emails that contain no UTF-8 encoded parts. - - Fixes #46297. - - *Jan Honza Sterba* - -* Add X-Forwarded-To addresses to recipients. - - *Andrew Stewart* - -Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionmailbox/CHANGELOG.md) for previous changes. +Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionmailbox/CHANGELOG.md) for previous changes. diff --git a/actionmailbox/lib/action_mailbox/gem_version.rb b/actionmailbox/lib/action_mailbox/gem_version.rb index 12896d629e4..c3151ec7f4c 100644 --- a/actionmailbox/lib/action_mailbox/gem_version.rb +++ b/actionmailbox/lib/action_mailbox/gem_version.rb @@ -8,9 +8,9 @@ module ActionMailbox module VERSION MAJOR = 7 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "rc1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/actionmailbox/test/dummy/db/schema.rb b/actionmailbox/test/dummy/db/schema.rb index 87f8fde0b9a..34b275b341d 100644 --- a/actionmailbox/test/dummy/db/schema.rb +++ b/actionmailbox/test/dummy/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2018_02_12_164506) do +ActiveRecord::Schema[7.2].define(version: 2018_02_12_164506) do create_table "action_mailbox_inbound_emails", force: :cascade do |t| t.integer "status", default: 0, null: false t.string "message_id", null: false diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index 921ad101384..cff1fbb9c12 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,133 +1,2 @@ -## Rails 7.1.0.rc1 (September 27, 2023) ## -* Introduce `ActionMailer::FormBuilder` - - Use the `default_form_builder` method in mailers to set the default form builder - for templates rendered by that mailer. Matches the behaviour in Action Controller. - - *Alex Ghiculescu* - - -## Rails 7.1.0.beta1 (September 13, 2023) ## - -* Mailers are listed in alphabetical order on the mailer preview page now. - - *Martin Spickermann* - -* Deprecate passing params to `assert_enqueued_email_with` via the `:args` - kwarg. `assert_enqueued_email_with` now supports a `:params` kwarg, so use - that to pass params: - - ```ruby - # BEFORE - assert_enqueued_email_with MyMailer, :my_method, args: { my_param: "value" } - - # AFTER - assert_enqueued_email_with MyMailer, :my_method, params: { my_param: "value" } - ``` - - To specify named mailer args as a Hash, wrap the Hash in an array: - - ```ruby - assert_enqueued_email_with MyMailer, :my_method, args: [{ my_arg: "value" }] - # OR - assert_enqueued_email_with MyMailer, :my_method, args: [my_arg: "value"] - ``` - - *Jonathan Hefner* - -* Accept procs for args and params in `assert_enqueued_email_with` - - ```ruby - assert_enqueued_email_with DeliveryJob, params: -> p { p[:token] =~ /\w+/ } do - UserMailer.with(token: user.generate_token).email_verification.deliver_later - end - ``` - - *Max Chernyak* - -* Added `*_deliver` callbacks to `ActionMailer::Base` that wrap mail message delivery. - - Example: - - ```ruby - class EventsMailer < ApplicationMailer - after_deliver do - User.find_by(email: message.to.first).update(email_provider_id: message.message_id, emailed_at: Time.current) - end - end - ``` - - *Ben Sheldon* - -* Added `deliver_enqueued_emails` to `ActionMailer::TestHelper`. This method - delivers all enqueued email jobs. - - Example: - - ```ruby - def test_deliver_enqueued_emails - deliver_enqueued_emails do - ContactMailer.welcome.deliver_later - end - assert_emails 1 - end - ``` - - *Andrew Novoselac* - -* The `deliver_later_queue_name` used by the default mailer job can now be - configured on a per-mailer basis. Previously this was only configurable - for all mailers via `ActionMailer::Base`. - - Example: - - ```ruby - class EventsMailer < ApplicationMailer - self.deliver_later_queue_name = :throttled_mailer - end - ``` - - *Jeffrey Hardy* - -* Email previews now include an expandable section to show all headers. - - Headers like `Message-ID` for threading or email service provider specific - features like analytics tags or account metadata can now be viewed directly - in the mailer preview. - - *Matt Swanson* - -* Default `ActionMailer::Parameterized#params` to an empty `Hash` - - *Sean Doyle* - -* Introduce the `capture_emails` test helper. - - Returns all emails that are sent in a block. - - ```ruby - def test_emails - emails = capture_emails do - ContactMailer.welcome.deliver_now - ContactMailer.welcome.deliver_later - end - assert_email "Hi there", emails.first.subject - end - ``` - - *Alex Ghiculescu* - -* Added ability to download `.eml` file for the email preview. - - *Igor Kasyanchuk* - -* Support multiple preview paths for mailers. - - Option `config.action_mailer.preview_path` is deprecated in favor of - `config.action_mailer.preview_paths`. Appending paths to this configuration option - will cause those paths to be used in the search for mailer previews. - - *fatkodima* - -Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionmailer/CHANGELOG.md) for previous changes. +Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionmailer/CHANGELOG.md) for previous changes. diff --git a/actionmailer/lib/action_mailer/gem_version.rb b/actionmailer/lib/action_mailer/gem_version.rb index 5984e1ef565..a891c030b87 100644 --- a/actionmailer/lib/action_mailer/gem_version.rb +++ b/actionmailer/lib/action_mailer/gem_version.rb @@ -8,9 +8,9 @@ module ActionMailer module VERSION MAJOR = 7 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "rc1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 962552a9dd2..4ff4f1eb32c 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,532 +1,2 @@ -## Rails 7.1.0.rc1 (September 27, 2023) ## -* Add support for `#deep_merge` and `#deep_merge!` to - `ActionController::Parameters`. - - *Sean Doyle* - - -## Rails 7.1.0.beta1 (September 13, 2023) ## - -* `AbstractController::Translation.raise_on_missing_translations` removed - - This was a private API, and has been removed in favour of a more broadly applicable - `config.i18n.raise_on_missing_translations`. See the upgrading guide for more information. - - *Alex Ghiculescu* - -* Add `ActionController::Parameters#extract_value` method to allow extracting serialized values from params - - ```ruby - params = ActionController::Parameters.new(id: "1_123", tags: "ruby,rails") - params.extract_value(:id) # => ["1", "123"] - params.extract_value(:tags, delimiter: ",") # => ["ruby", "rails"] - ``` - - *Nikita Vasilevsky* - -* Parse JSON `response.parsed_body` with `ActiveSupport::HashWithIndifferentAccess` - - Integrate with Minitest's new `assert_pattern` by parsing the JSON contents - of `response.parsed_body` with `ActiveSupport::HashWithIndifferentAccess`, so - that it's pattern-matching compatible. - - *Sean Doyle* - -* Add support for Playwright as a driver for system tests. - - *Yuki Nishijima* - -* Fix `HostAuthorization` potentially displaying the value of the - X_FORWARDED_HOST header when the HTTP_HOST header is being blocked. - - *Hartley McGuire*, *Daniel Schlosser* - -* Rename `fixture_file_upload` method to `file_fixture_upload` - - Declare an alias to preserve the backwards compatibility of `fixture_file_upload` - - *Sean Doyle* - -* `ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper` saves the screenshot path in test metadata on failure. - - *Matija Čupić* - -* `config.dom_testing_default_html_version` controls the HTML parser used by - `ActionDispatch::Assertions#html_document`. - - The Rails 7.1 default configuration opts into the HTML5 parser when it is supported, to better - represent what the DOM would be in a browser user agent. Previously this test helper always used - Nokogiri's HTML4 parser. - - *Mike Dalessio* - -* The `with_routing` helper can now be called at the class level. When called at the class level, the routes will - be setup before each test, and reset after every test. For example: - - ```ruby - class RoutingTest < ActionController::TestCase - with_routing do |routes| - routes.draw do - resources :articles - resources :authors - end - end - - def test_articles_route - assert_routing("/articles", controller: "articles", action: "index") - end - - def test_authors_route - assert_routing("/authors", controller: "authors", action: "index") - end - end - ``` - - *Andrew Novoselac* - -* The `Mime::Type` now supports handling types with parameters and correctly handles quotes. - When parsing the accept header, the parameters before the q-parameter are kept and if a matching mime-type exists it is used. - To keep the current functionality, a fallback is created to look for the media-type without the parameters. - - This change allows for custom MIME-types that are more complex like `application/vnd.api+json; profile="https://jsonapi.org/profiles/ethanresnick/cursor-pagination/" ext="https://jsonapi.org/ext/atomic"` for the [JSON API](https://jsonapi.org/). - - *Nicolas Erni* - -* The url_for helpers now support a new option called `path_params`. - This is very useful in situations where you only want to add a required param that is part of the route's URL but for other route not append an extraneous query param. - - Given the following router... - - ```ruby - Rails.application.routes.draw do - scope ":account_id" do - get "dashboard" => "pages#dashboard", as: :dashboard - get "search/:term" => "search#search", as: :search - end - delete "signout" => "sessions#destroy", as: :signout - end - ``` - - And given the following `ApplicationController` - - ```ruby - class ApplicationController < ActionController::Base - def default_url_options - { path_params: { account_id: "foo" } } - end - end - ``` - - The standard url_for helper and friends will now behave as follows: - - ```ruby - dashboard_path # => /foo/dashboard - dashboard_path(account_id: "bar") # => /bar/dashboard - - signout_path # => /signout - signout_path(account_id: "bar") # => /signout?account_id=bar - signout_path(account_id: "bar", path_params: { account_id: "baz" }) # => /signout?account_id=bar - search_path("quin") # => /foo/search/quin - ``` - - *Jason Meller, Jeremy Beker* - -* Change `action_dispatch.show_exceptions` to one of `:all`, `:rescuable`, or - `:none`. `:all` and `:none` behave the same as the previous `true` and - `false` respectively. The new `:rescuable` option will only show exceptions - that can be rescued (e.g. `ActiveRecord::RecordNotFound`). `:rescuable` is - now the default for the test environment. - - *Jon Dufresne* - -* `config.action_dispatch.cookies_serializer` now accepts `:message_pack` and - `:message_pack_allow_marshal` as serializers. These serializers require the - [`msgpack` gem](https://rubygems.org/gems/msgpack) (>= 1.7.0). - - The Message Pack format can provide improved performance and smaller payload - sizes. It also supports roundtripping some Ruby types that are not supported - by JSON. For example: - - ```ruby - cookies.encrypted[:foo] = [{ a: 1 }, { b: 2 }.with_indifferent_access, 1.to_d, Time.at(0, 123)] - - # BEFORE with config.action_dispatch.cookies_serializer = :json - cookies.encrypted[:foo] - # => [{"a"=>1}, {"b"=>2}, "1.0", "1969-12-31T18:00:00.000-06:00"] - cookies.encrypted[:foo].map(&:class) - # => [Hash, Hash, String, String] - - # AFTER with config.action_dispatch.cookies_serializer = :message_pack - cookies.encrypted[:foo] - # => [{:a=>1}, {"b"=>2}, 0.1e1, 1969-12-31 18:00:00.000123 -0600] - cookies.encrypted[:foo].map(&:class) - # => [Hash, ActiveSupport::HashWithIndifferentAccess, BigDecimal, Time] - ``` - - The `:message_pack` serializer can fall back to deserializing with - `ActiveSupport::JSON` when necessary, and the `:message_pack_allow_marshal` - serializer can fall back to deserializing with `Marshal` as well as - `ActiveSupport::JSON`. Additionally, the `:marshal`, `:json`, and - `:json_allow_marshal` (AKA `:hybrid`) serializers can now fall back to - deserializing with `ActiveSupport::MessagePack` when necessary. These - behaviors ensure old cookies can still be read so that migration is easier. - - *Jonathan Hefner* - -* Remove leading dot from domains on cookies set with `domain: :all`, to meet RFC6265 requirements - - *Gareth Adams* - -* Include source location in routes extended view. - - ```bash - $ bin/rails routes --expanded - - ... - --[ Route 14 ]---------- - Prefix | new_gist - Verb | GET - URI | /gist(.:format) - Controller#Action | gists/gists#new - Source Location | config/routes/gist.rb:3 - ``` - - *Luan Vieira, John Hawthorn and Daniel Colson* - -* Add `without` as an alias of `except` on `ActiveController::Parameters`. - - *Hidde-Jan Jongsma* - -* Expand search field on `rails/info/routes` to also search **route name**, **http verb** and **controller#action**. - - *Jason Kotchoff* - -* Remove deprecated `poltergeist` and `webkit` (capybara-webkit) driver registration for system testing. - - *Rafael Mendonça França* - -* Remove deprecated ability to assign a single value to `config.action_dispatch.trusted_proxies`. - - *Rafael Mendonça França* - -* Deprecate `config.action_dispatch.return_only_request_media_type_on_content_type`. - - *Rafael Mendonça França* - -* Remove deprecated behavior on `Request#content_type`. - - *Rafael Mendonça França* - -* Change `ActionController::Instrumentation` to pass `filtered_path` instead of `fullpath` in the event payload to filter sensitive query params - - ```ruby - get "/posts?password=test" - request.fullpath # => "/posts?password=test" - request.filtered_path # => "/posts?password=[FILTERED]" - ``` - - *Ritikesh G* - -* Deprecate `AbstractController::Helpers::MissingHelperError` - - *Hartley McGuire* - -* Change `ActionDispatch::Testing::TestResponse#parsed_body` to parse HTML as - a Nokogiri document - - ```ruby - get "/posts" - response.content_type # => "text/html; charset=utf-8" - response.parsed_body.class # => Nokogiri::HTML5::Document - response.parsed_body.to_html # => "\n\n..." - ``` - - *Sean Doyle* - -* Deprecate `ActionDispatch::IllegalStateError`. - - *Samuel Williams* - -* Add HTTP::Request#route_uri_pattern that returns URI pattern of matched route. - - *Joel Hawksley*, *Kate Higa* - -* Add `ActionDispatch::AssumeSSL` middleware that can be turned on via `config.assume_ssl`. - It makes the application believe that all requests are arriving over SSL. This is useful - when proxying through a load balancer that terminates SSL, the forwarded request will appear - as though its HTTP instead of HTTPS to the application. This makes redirects and cookie - security target HTTP instead of HTTPS. This middleware makes the server assume that the - proxy already terminated SSL, and that the request really is HTTPS. - - *DHH* - -* Only use HostAuthorization middleware if `config.hosts` is not empty - - *Hartley McGuire* - -* Allow raising an error when a callback's only/unless symbols aren't existing methods. - - When `before_action :callback, only: :action_name` is declared on a controller that doesn't respond to `action_name`, raise an exception at request time. This is a safety measure to ensure that typos or forgetfulness don't prevent a crucial callback from being run when it should. - - For new applications, raising an error for undefined actions is turned on by default. If you do not want to opt-in to this behavior set `config.action_pack.raise_on_missing_callback_actions` to `false` in your application configuration. See #43487 for more details. - - *Jess Bees* - -* Allow cookie options[:domain] to accept a proc to set the cookie domain on a more flexible per-request basis - - *RobL* - -* When a host is not specified for an `ActionController::Renderer`'s env, - the host and related options will now be derived from the routes' - `default_url_options` and `ActionDispatch::Http::URL.secure_protocol`. - - This means that for an application with a configuration like: - - ```ruby - Rails.application.default_url_options = { host: "rubyonrails.org" } - Rails.application.config.force_ssl = true - ``` - - rendering a URL like: - - ```ruby - ApplicationController.renderer.render inline: "<%= blog_url %>" - ``` - - will now return `"https://rubyonrails.org/blog"` instead of - `"http://example.org/blog"`. - - *Jonathan Hefner* - -* Add details of cookie name and size to `CookieOverflow` exception. - - *Andy Waite* - -* Don't double log the `controller`, `action`, or `namespaced_controller` when using `ActiveRecord::QueryLog` - - Previously if you set `config.active_record.query_log_tags` to an array that included - `:controller`, `:namespaced_controller`, or `:action`, that item would get logged twice. - This bug has been fixed. - - *Alex Ghiculescu* - -* Add the following permissions policy directives: `hid`, `idle-detection`, `screen-wake-lock`, - `serial`, `sync-xhr`, `web-share`. - - *Guillaume Cabanel* - -* The `speaker`, `vibrate`, and `vr` permissions policy directives are now - deprecated. - - There is no browser support for these directives, and no plan for browser - support in the future. You can just remove these directives from your - application. - - *Jonathan Hefner* - -* Added the `:status` option to `assert_redirected_to` to specify the precise - HTTP status of the redirect. Defaults to `:redirect` for backwards - compatibility. - - *Jon Dufresne* - -* Rescue `JSON::ParserError` in Cookies JSON deserializer to discards marshal dumps: - - Without this change, if `action_dispatch.cookies_serializer` is set to `:json` and - the app tries to read a `:marshal` serialized cookie, it would error out which wouldn't - clear the cookie and force app users to manually clear it in their browser. - - (See #45127 for original bug discussion) - - *Nathan Bardoux* - -* Add `HTTP_REFERER` when following redirects on integration tests - - This makes `follow_redirect!` a closer simulation of what happens in a real browser - - *Felipe Sateler* - -* Added `exclude?` method to `ActionController::Parameters`. - - *Ian Neubert* - -* Rescue `EOFError` exception from `rack` on a multipart request. - - *Nikita Vasilevsky* - -* Log redirects from routes the same way as redirects from controllers. - - *Dennis Paagman* - -* Prevent `ActionDispatch::ServerTiming` from overwriting existing values in `Server-Timing`. - Previously, if another middleware down the chain set `Server-Timing` header, - it would overwritten by `ActionDispatch::ServerTiming`. - - *Jakub Malinowski* - -* Allow opting out of the `SameSite` cookie attribute when setting a cookie. - - You can opt out of `SameSite` by passing `same_site: nil`. - - `cookies[:foo] = { value: "bar", same_site: nil }` - - Previously, this incorrectly set the `SameSite` attribute to the value of the `cookies_same_site_protection` setting. - - *Alex Ghiculescu* - -* Allow using `helper_method`s in `content_security_policy` and `permissions_policy` - - Previously you could access basic helpers (defined in helper modules), but not - helper methods defined using `helper_method`. Now you can use either. - - ```ruby - content_security_policy do |p| - p.default_src "https://example.com" - p.script_src "https://example.com" if helpers.script_csp? - end - ``` - - *Alex Ghiculescu* - -* Reimplement `ActionController::Parameters#has_value?` and `#value?` to avoid parameters and hashes comparison. - - Deprecated equality between parameters and hashes is going to be removed in Rails 7.2. - The new implementation takes care of conversions. - - *Seva Stefkin* - -* Allow only String and Symbol keys in `ActionController::Parameters`. - Raise `ActionController::InvalidParameterKey` when initializing Parameters - with keys that aren't strings or symbols. - - *Seva Stefkin* - -* Add the ability to use custom logic for storing and retrieving CSRF tokens. - - By default, the token will be stored in the session. Custom classes can be - defined to specify arbitrary behavior, but the ability to store them in - encrypted cookies is built in. - - *Andrew Kowpak* - -* Make ActionController::Parameters#values cast nested hashes into parameters. - - *Gannon McGibbon* - -* Introduce `html:` and `screenshot:` kwargs for system test screenshot helper - - Use these as an alternative to the already-available environment variables. - - For example, this will display a screenshot in iTerm, save the HTML, and output - its path. - - ```ruby - take_screenshot(html: true, screenshot: "inline") - ``` - - *Alex Ghiculescu* - -* Allow `ActionController::Parameters#to_h` to receive a block. - - *Bob Farrell* - -* Allow relative redirects when `raise_on_open_redirects` is enabled - - *Tom Hughes* - -* Allow Content Security Policy DSL to generate for API responses. - - *Tim Wade* - -* Fix `authenticate_with_http_basic` to allow for missing password. - - Before Rails 7.0 it was possible to handle basic authentication with only a username. - - ```ruby - authenticate_with_http_basic do |token, _| - ApiClient.authenticate(token) - end - ``` - - This ability is restored. - - *Jean Boussier* - -* Fix `content_security_policy` returning invalid directives. - - Directives such as `self`, `unsafe-eval` and few others were not - single quoted when the directive was the result of calling a lambda - returning an array. - - ```ruby - content_security_policy do |policy| - policy.frame_ancestors lambda { [:self, "https://example.com"] } - end - ``` - - With this fix the policy generated from above will now be valid. - - *Edouard Chin* - -* Fix `skip_forgery_protection` to run without raising an error if forgery - protection has not been enabled / `verify_authenticity_token` is not a - defined callback. - - This fix prevents the Rails 7.0 Welcome Page (`/`) from raising an - `ArgumentError` if `default_protect_from_forgery` is false. - - *Brad Trick* - -* Make `redirect_to` return an empty response body. - - Application controllers that wish to add a response body after calling - `redirect_to` can continue to do so. - - *Jon Dufresne* - -* Use non-capturing group for subdomain matching in `ActionDispatch::HostAuthorization` - - Since we do nothing with the captured subdomain group, we can use a non-capturing group instead. - - *Sam Bostock* - -* Fix `ActionController::Live` to copy the IsolatedExecutionState in the ephemeral thread. - - Since its inception `ActionController::Live` has been copying thread local variables - to keep things such as `CurrentAttributes` set from middlewares working in the controller action. - - With the introduction of `IsolatedExecutionState` in 7.0, some of that global state was lost in - `ActionController::Live` controllers. - - *Jean Boussier* - -* Fix setting `trailing_slash: true` in route definition. - - ```ruby - get '/test' => "test#index", as: :test, trailing_slash: true - - test_path() # => "/test/" - ``` - - *Jean Boussier* - -* Make `Session#merge!` stringify keys. - - Previously `Session#update` would, but `merge!` wouldn't. - - *Drew Bragg* - -* Add `:unsafe_hashes` mapping for `content_security_policy` - - ```ruby - # Before - policy.script_src :strict_dynamic, "'unsafe-hashes'", "'sha256-rRMdkshZyJlCmDX27XnL7g3zXaxv7ei6Sg+yt4R3svU='" - - # After - policy.script_src :strict_dynamic, :unsafe_hashes, "'sha256-rRMdkshZyJlCmDX27XnL7g3zXaxv7ei6Sg+yt4R3svU='" - ``` - - *Igor Morozov* - -Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionpack/CHANGELOG.md) for previous changes. +Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionpack/CHANGELOG.md) for previous changes. diff --git a/actionpack/lib/action_pack/gem_version.rb b/actionpack/lib/action_pack/gem_version.rb index e55c9386398..5d6e1aca1d1 100644 --- a/actionpack/lib/action_pack/gem_version.rb +++ b/actionpack/lib/action_pack/gem_version.rb @@ -8,9 +8,9 @@ module ActionPack module VERSION MAJOR = 7 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "rc1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/actiontext/CHANGELOG.md b/actiontext/CHANGELOG.md index e19102a084a..f584fc58ed4 100644 --- a/actiontext/CHANGELOG.md +++ b/actiontext/CHANGELOG.md @@ -1,63 +1,2 @@ -## Rails 7.1.0.rc1 (September 27, 2023) ## -* No changes. - - -## Rails 7.1.0.beta1 (September 13, 2023) ## - -* Use `Rails::HTML5::SafeListSanitizer` by default in the Rails 7.1 configuration if it is - supported. - - Action Text's sanitizer can be configured by setting - `config.action_text.sanitizer_vendor`. Supported values are `Rails::HTML4::Sanitizer` or - `Rails::HTML5::Sanitizer`. - - The Rails 7.1 configuration will set this to `Rails::HTML5::Sanitizer` when it is supported, and - fall back to `Rails::HTML4::Sanitizer`. Previous configurations default to - `Rails::HTML4::Sanitizer`. - - As a result of this change, the defaults for `ActionText::ContentHelper.allowed_tags` and - `.allowed_attributes` are applied at runtime, so the value of these attributes is now 'nil' - unless set by the application. You may call `sanitizer_allowed_tags` or - `sanitizer_allowed_attributes` to inspect the tags and attributes being allowed by the - sanitizer. - - *Mike Dalessio* - -* Attachables now can override default attachment missing template. - - When rendering Action Text attachments where the underlying attachable model has - been removed, a fallback template is used. You now can override this template on - a per-model basis. For example, you could render a placeholder image for a file - attachment or the text "Deleted User" for a User attachment. - - *Matt Swanson*, *Joel Drapper* - -* Update bundled Trix version from `1.3.1` to `2.0.4`. - - *Sarah Ridge*, *Sean Doyle* - -* Apply `field_error_proc` to `rich_text_area` form fields. - - *Kaíque Kandy Koga* - -* Action Text attachment URLs rendered in a background job (a la Turbo - Streams) now use `Rails.application.default_url_options` and - `Rails.application.config.force_ssl` instead of `http://example.org`. - - *Jonathan Hefner* - -* Support `strict_loading:` option for `has_rich_text` declaration - - *Sean Doyle* - -* Update ContentAttachment so that it can encapsulate arbitrary HTML content in a document. - - *Jamis Buck* - -* Fix an issue that caused the content layout to render multiple times when a - rich_text field was updated. - - *Jacob Herrington* - -Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actiontext/CHANGELOG.md) for previous changes. +Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actiontext/CHANGELOG.md) for previous changes. diff --git a/actiontext/lib/action_text/gem_version.rb b/actiontext/lib/action_text/gem_version.rb index 83331c0f09e..d003935fbb9 100644 --- a/actiontext/lib/action_text/gem_version.rb +++ b/actiontext/lib/action_text/gem_version.rb @@ -8,9 +8,9 @@ module ActionText module VERSION MAJOR = 7 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "rc1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/actiontext/package.json b/actiontext/package.json index a8a2b7219d5..5d4f52c9942 100644 --- a/actiontext/package.json +++ b/actiontext/package.json @@ -1,6 +1,6 @@ { "name": "@rails/actiontext", - "version": "7.1.0-rc1", + "version": "7.2.0-alpha", "description": "Edit and display rich text in Rails applications", "main": "app/assets/javascripts/actiontext.js", "type": "module", diff --git a/actiontext/test/dummy/db/schema.rb b/actiontext/test/dummy/db/schema.rb index 4f54ab17b99..00cdb967b01 100644 --- a/actiontext/test/dummy/db/schema.rb +++ b/actiontext/test/dummy/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2019_03_17_200724) do +ActiveRecord::Schema[7.2].define(version: 2019_03_17_200724) do create_table "action_text_rich_texts", force: :cascade do |t| t.string "name", null: false t.text "body" diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index a323f7108be..ed66f6466c5 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -1,392 +1,2 @@ -## Rails 7.1.0.rc1 (September 27, 2023) ## -* Introduce `ActionView::TestCase.register_parser` - - ```ruby - register_parser :rss, -> rendered { RSS::Parser.parse(rendered) } - - test "renders RSS" do - article = Article.create!(title: "Hello, world") - - render formats: :rss, partial: article - - assert_equal "Hello, world", rendered.rss.items.last.title - end - ``` - - By default, register parsers for `:html` and `:json`. - - *Sean Doyle* - - -## Rails 7.1.0.beta1 (September 13, 2023) ## - -* Fix `simple_format` with blank `wrapper_tag` option returns plain html tag - - By default `simple_format` method returns the text wrapped with `
`. But if we explicitly specify - the `wrapper_tag: nil` in the options, it returns the text wrapped with `<>>` tag. - - Before: - - ```ruby - simple_format("Hello World", {}, { wrapper_tag: nil }) - # <>Hello World> - ``` - - After: - - ```ruby - simple_format("Hello World", {}, { wrapper_tag: nil }) - #
Hello World
- ``` - - *Akhil G Krishnan*, *Junichi Ito* - -* Don't double-encode nested `field_id` and `field_name` index values - - Pass `index: @options` as a default keyword argument to `field_id` and - `field_name` view helper methods. - - *Sean Doyle* - -* Allow opting in/out of `Link preload` headers when calling `stylesheet_link_tag` or `javascript_include_tag` - - ```ruby - # will exclude header, even if setting is enabled: - javascript_include_tag("http://example.com/all.js", preload_links_header: false) - - # will include header, even if setting is disabled: - stylesheet_link_tag("http://example.com/all.js", preload_links_header: true) - ``` - - *Alex Ghiculescu* - -* Stop generating `Link preload` headers once it has reached 1KB. - - Some proxies have trouble handling large headers, but more importantly preload links - have diminishing returns so it's preferable not to go overboard with them. - - If tighter control is needed, it's recommended to disable automatic generation of preloads - and to generate them manually from the controller or from a middleware. - - *Jean Boussier* - -* `simple_format` helper now handles a `:sanitize_options` - any extra options you want appending to the sanitize. - - Before: - ```ruby - simple_format("Continue") - # => "" - ``` - - After: - ```ruby - simple_format("Continue", {}, { sanitize_options: { attributes: %w[target href] } }) - # => "" - ``` - - *Andrei Andriichuk* - -* Add support for HTML5 standards-compliant sanitizers, and default to `Rails::HTML5::Sanitizer` - in the Rails 7.1 configuration if it is supported. - - Action View's HTML sanitizers can be configured by setting - `config.action_view.sanitizer_vendor`. Supported values are `Rails::HTML4::Sanitizer` or - `Rails::HTML5::Sanitizer`. - - The Rails 7.1 configuration will set this to `Rails::HTML5::Sanitizer` when it is supported, and - fall back to `Rails::HTML4::Sanitizer`. Previous configurations default to - `Rails::HTML4::Sanitizer`. - - *Mike Dalessio* - -* `config.dom_testing_default_html_version` controls the HTML parser used by - `ActionView::TestCase#document_root_element`, which creates the DOM used by the assertions in - Rails::Dom::Testing. - - The Rails 7.1 default configuration opts into the HTML5 parser when it is supported, to better - represent what the DOM would be in a browser user agent. Previously this test helper always used - Nokogiri's HTML4 parser. - - *Mike Dalessio* - -* Add support for the HTML picture tag. It supports passing a String, an Array or a Block. - Supports passing properties directly to the img tag via the `:image` key. - Since the picture tag requires an img tag, the last element you provide will be used for the img tag. - For complete control over the picture tag, a block can be passed, which will populate the contents of the tag accordingly. - - Can be used like this for a single source: - ```erb - <%= picture_tag("picture.webp") %> - ``` - which will generate the following: - ```html - - ``` - - For multiple sources: - ```erb - <%= picture_tag("picture.webp", "picture.png", :class => "mt-2", :image => { alt: "Image", class: "responsive-img" }) %> - ``` - will generate: - ```html - - ``` - - Full control via a block: - ```erb - <%= picture_tag(:class => "my-class") do %> - <%= tag(:source, :srcset => image_path("picture.webp")) %> - <%= tag(:source, :srcset => image_path("picture.png")) %> - <%= image_tag("picture.png", :alt => "Image") %> - <% end %> - ``` - will generate: - ```html - - ``` - - *Juan Pablo Balarini* - -* Remove deprecated support to passing instance variables as locals to partials. - - *Rafael Mendonça França* - -* Remove deprecated constant `ActionView::Path`. - - *Rafael Mendonça França* - -* Guard `token_list` calls from escaping HTML too often - - *Sean Doyle* - -* `select` can now be called with a single hash containing options and some HTML options - - Previously this would not work as expected: - - ```erb - <%= select :post, :author, authors, required: true %> - ``` - - Instead you needed to do this: - - ```erb - <%= select :post, :author, authors, {}, required: true %> - ``` - - Now, either form is accepted, for the following HTML attributes: `required`, `multiple`, `size`. - - *Alex Ghiculescu* - -* Datetime form helpers (`time_field`, `date_field`, `datetime_field`, `week_field`, `month_field`) now accept an instance of Time/Date/DateTime as `:value` option. - - Before: - ```erb - <%= form.datetime_field :written_at, value: Time.current.strftime("%Y-%m-%dT%T") %> - ``` - - After: - ```erb - <%= form.datetime_field :written_at, value: Time.current %> - ``` - - *Andrey Samsonov* - -* Choices of `select` can optionally contain html attributes as the last element - of the child arrays when using grouped/nested collections - - ```erb - <%= form.select :foo, [["North America", [["United States","US"],["Canada","CA"]], { disabled: "disabled" }]] %> - # => - ``` - - *Chris Gunther* - -* `check_box_tag` and `radio_button_tag` now accept `checked` as a keyword argument - - This is to make the API more consistent with the `FormHelper` variants. You can now - provide `checked` as a positional or keyword argument: - - ```erb - = check_box_tag "admin", "1", false - = check_box_tag "admin", "1", checked: false - - = radio_button_tag 'favorite_color', 'maroon', false - = radio_button_tag 'favorite_color', 'maroon', checked: false - ``` - - *Alex Ghiculescu* - -* Allow passing a class to `dom_id`. - You no longer need to call `new` when passing a class to `dom_id`. - This makes `dom_id` behave like `dom_class` in this regard. - Apart from saving a few keystrokes, it prevents Ruby from needing - to instantiate a whole new object just to generate a string. - - Before: - ```ruby - dom_id(Post) # => NoMethodError: undefined method `to_key' for Post:Class - ``` - - After: - ```ruby - dom_id(Post) # => "new_post" - ``` - - *Goulven Champenois* - -* Report `:locals` as part of the data returned by ActionView render instrumentation. - - Before: - ```ruby - { - identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb", - layout: "layouts/application" - } - ``` - - After: - ```ruby - { - identifier: "/Users/adam/projects/notifications/app/views/posts/index.html.erb", - layout: "layouts/application", - locals: {foo: "bar"} - } - ``` - - *Aaron Gough* - -* Strip `break_sequence` at the end of `word_wrap`. - - This fixes a bug where `word_wrap` didn't properly strip off break sequences that had printable characters. - - For example, compare the outputs of this template: - - ```erb - # <%= word_wrap("11 22\n33 44", line_width: 2, break_sequence: "\n# ") %> - ``` - - Before: - - ``` - # 11 - # 22 - # - # 33 - # 44 - # - ``` - - After: - - ``` - # 11 - # 22 - # 33 - # 44 - ``` - - *Max Chernyak* - -* Allow templates to set strict `locals`. - - By default, templates will accept any `locals` as keyword arguments. To define what `locals` a template accepts, add a `locals` magic comment: - - ```erb - <%# locals: (message:) -%> - <%= message %> - ``` - - Default values can also be provided: - - ```erb - <%# locals: (message: "Hello, world!") -%> - <%= message %> - ``` - - Or `locals` can be disabled entirely: - - ```erb - <%# locals: () %> - ``` - - *Joel Hawksley* - -* Add `include_seconds` option for `datetime_local_field` - - This allows to omit seconds part in the input field, by passing `include_seconds: false` - - *Wojciech Wnętrzak* - -* Guard against `ActionView::Helpers::FormTagHelper#field_name` calls with nil - `object_name` arguments. For example: - - ```erb - <%= fields do |f| %> - <%= f.field_name :body %> - <% end %> - ``` - - *Sean Doyle* - -* Strings returned from `strip_tags` are correctly tagged `html_safe?` - - Because these strings contain no HTML elements and the basic entities are escaped, they are safe - to be included as-is as PCDATA in HTML content. Tagging them as html-safe avoids double-escaping - entities when being concatenated to a SafeBuffer during rendering. - - Fixes [rails/rails-html-sanitizer#124](https://github.com/rails/rails-html-sanitizer/issues/124) - - *Mike Dalessio* - -* Move `convert_to_model` call from `form_for` into `form_with` - - Now that `form_for` is implemented in terms of `form_with`, remove the - `convert_to_model` call from `form_for`. - - *Sean Doyle* - -* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`. - - Escape dangerous characters in names of tags and names of attributes in the - tag helpers, following the XML specification. Rename the option - `:escape_attributes` to `:escape`, to simplify by applying the option to the - whole tag. - - *Álvaro Martín Fraguas* - -* Extend audio_tag and video_tag to accept Active Storage attachments. - - Now it's possible to write - - ```ruby - audio_tag(user.audio_file) - video_tag(user.video_file) - ``` - - Instead of - - ```ruby - audio_tag(polymorphic_path(user.audio_file)) - video_tag(polymorphic_path(user.video_file)) - ``` - - `image_tag` already supported that, so this follows the same pattern. - - *Matheus Richard* - -* Ensure models passed to `form_for` attempt to call `to_model`. - - *Sean Doyle* - -Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionview/CHANGELOG.md) for previous changes. +Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionview/CHANGELOG.md) for previous changes. diff --git a/actionview/lib/action_view/gem_version.rb b/actionview/lib/action_view/gem_version.rb index 6eb3c504ff5..d7b711cf742 100644 --- a/actionview/lib/action_view/gem_version.rb +++ b/actionview/lib/action_view/gem_version.rb @@ -8,9 +8,9 @@ module ActionView module VERSION MAJOR = 7 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "rc1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/actionview/package.json b/actionview/package.json index 63139ea1624..c7d394fe0d2 100644 --- a/actionview/package.json +++ b/actionview/package.json @@ -1,6 +1,6 @@ { "name": "@rails/ujs", - "version": "7.1.0-rc1", + "version": "7.2.0-alpha", "description": "Ruby on Rails unobtrusive scripting adapter", "main": "app/assets/javascripts/rails-ujs.js", "module": "app/assets/javascripts/rails-ujs.esm.js", diff --git a/activejob/CHANGELOG.md b/activejob/CHANGELOG.md index a46916f79d8..ba6d525b207 100644 --- a/activejob/CHANGELOG.md +++ b/activejob/CHANGELOG.md @@ -1,224 +1,2 @@ -## Rails 7.1.0.rc1 (September 27, 2023) ## -* Set `scheduled_at` attribute as a Time object instead of epoch seconds, and serialize and deserialize the value - when enqueued. Assigning a numeric/epoch value to scheduled_at= is deprecated; use a Time object instead. - - Deserializes `enqueued_at` as a Time instead of ISO8601 String. - - *Ben Sheldon* - -* Clarify the backoff strategy for the recommended `:wait` option when retrying jobs - - `wait: :exponentially_longer` is waiting polynomially longer, so it is now recommended to use `wait: :polynomially_longer` to keep the same behavior. - - *Victor Mours* - - -## Rails 7.1.0.beta1 (September 13, 2023) ## - -* Fix Active Job log message to correctly report a job failed to enqueue - when the adapter raises an `ActiveJob::EnqueueError`. - - *Ben Sheldon* - -* Add `after_discard` method. - - This method lets job authors define a block which will be run when a job is about to be discarded. For example: - - ```ruby - class AfterDiscardJob < ActiveJob::Base - after_discard do |job, exception| - Rails.logger.info("#{job.class} raised an exception: #{exception}") - end - - def perform - raise StandardError - end - end - ``` - - The above job will run the block passed to `after_discard` after the job is discarded. The exception will - still be raised after the block has been run. - - *Rob Cardy* - -* Fix deserialization of ActiveSupport::Duration - - Previously, a deserialized Duration would return an array from Duration#parts. - It will now return a hash just like a regular Duration. - - This also fixes an error when trying to add or subtract from a deserialized Duration - (eg `duration + 1.year`). - - *Jonathan del Strother* - -* `perform_enqueued_jobs` is now compatible with all Active Job adapters - - This means that methods that depend on it, like Action Mailer's `assert_emails`, - will work correctly even if the test adapter is not used. - - *Alex Ghiculescu* - -* Allow queue adapters to provide a custom name by implementing `queue_adapter_name` - - *Sander Verdonschot* - -* Log background job enqueue callers - - Add `verbose_enqueue_logs` configuration option to display the caller - of background job enqueue in the log to help with debugging. - - Example log line: - - ``` - Enqueued AvatarThumbnailsJob (Job ID: ab528951-41fb-4c48-9129-3171791c27d6) to Sidekiq(default) with arguments: 1092412064 - ↳ app/models/user.rb:421:in `generate_avatar_thumbnails' - ``` - - Enabled in development only for new and upgraded applications. Not recommended for use - in the production environment since it relies on Ruby's `Kernel#caller` which is fairly slow. - - *fatkodima* - -* Set `provider_job_id` for Backburner jobs - - *Cameron Matheson* - -* Add `perform_all_later` to enqueue multiple jobs at once - - This adds the ability to bulk enqueue jobs, without running callbacks, by - passing multiple jobs or an array of jobs. For example: - - ```ruby - ActiveJob.perform_all_later(MyJob.new("hello", 42), MyJob.new("world", 0)) - - user_jobs = User.pluck(:id).map { |id| UserJob.new(user_id: id) } - ActiveJob.perform_all_later(user_jobs) - ``` - - This can greatly reduce the number of round-trips to the queue datastore. - For queue adapters that do not implement the new `enqueue_all` method, we - fall back to enqueuing jobs individually. The Sidekiq adapter implements - `enqueue_all` with `push_bulk`. - - This method does not use the existing `enqueue.active_job` event, but adds a - new event `enqueue_all.active_job`. - - *Sander Verdonschot* - -* Don't double log the `job` when using `ActiveRecord::QueryLog` - - Previously if you set `config.active_record.query_log_tags` to an array that included - `:job`, the job name would get logged twice. This bug has been fixed. - - *Alex Ghiculescu* - -* Add support for Sidekiq's transaction-aware client - - *Jonathan del Strother* - -* Remove QueAdapter from Active Job. - - After maintaining Active Job QueAdapter by Rails and Que side - to support Ruby 3 keyword arguments and options provided as top level keywords, - it is quite difficult to maintain it this way. - - Active Job Que adapter can be included in the future version of que gem itself. - - *Yasuo Honda* - -* Fix BigDecimal (de)serialization for adapters using JSON. - - Previously, BigDecimal was listed as not needing a serializer. However, - when used with an adapter storing the job arguments as JSON, it would get - serialized as a simple String, resulting in deserialization also producing - a String (instead of a BigDecimal). - - By using a serializer, we ensure the round trip is safe. - - To ensure applications using BigDecimal job arguments are not subject to - race conditions during deployment (where a replica running a version of - Rails without BigDecimalSerializer fails to deserialize an argument - serialized with it), `ActiveJob.use_big_decimal_serializer` is disabled by - default, and can be set to true in a following deployment.. - - *Sam Bostock* - -* Preserve full-precision `enqueued_at` timestamps for serialized jobs, - allowing more accurate reporting of how long a job spent waiting in the - queue before it was performed. - - Retains IS08601 format compatibility. - - *Jeremy Daer* - -* Add `--parent` option to job generator to specify parent class of job. - - Example: - - `bin/rails g job process_payment --parent=payment_job` generates: - - ```ruby - class ProcessPaymentJob < PaymentJob - # ... - end - ``` - - *Gannon McGibbon* - -* Add more detailed description to job generator. - - *Gannon McGibbon* - -* `perform.active_job` notification payloads now include `:db_runtime`, which - is the total time (in ms) taken by database queries while performing a job. - This value can be used to better understand how a job's time is spent. - - *Jonathan Hefner* - -* Update `ActiveJob::QueueAdapters::QueAdapter` to remove deprecation warning. - - Remove a deprecation warning introduced in que 1.2 to prepare for changes in - que 2.0 necessary for Ruby 3 compatibility. - - *Damir Zekic* and *Adis Hasovic* - -* Add missing `bigdecimal` require in `ActiveJob::Arguments` - - Could cause `uninitialized constant ActiveJob::Arguments::BigDecimal (NameError)` - when loading Active Job in isolation. - - *Jean Boussier* - -* Allow testing `discard_on/retry_on ActiveJob::DeserializationError` - - Previously in `perform_enqueued_jobs`, `deserialize_arguments_if_needed` - was called before calling `perform_now`. When a record no longer exists - and is serialized using GlobalID this led to raising - an `ActiveJob::DeserializationError` before reaching `perform_now` call. - This behavior makes difficult testing the job `discard_on/retry_on` logic. - - Now `deserialize_arguments_if_needed` call is postponed to when `perform_now` - is called. - - Example: - - ```ruby - class UpdateUserJob < ActiveJob::Base - discard_on ActiveJob::DeserializationError - - def perform(user) - # ... - end - end - - # In the test - User.destroy_all - assert_nothing_raised do - perform_enqueued_jobs only: UpdateUserJob - end - ``` - - *Jacopo Beschi* - -Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/activejob/CHANGELOG.md) for previous changes. +Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/activejob/CHANGELOG.md) for previous changes. diff --git a/activejob/lib/active_job/gem_version.rb b/activejob/lib/active_job/gem_version.rb index ede7a2fbbc6..ef81c3ee0b2 100644 --- a/activejob/lib/active_job/gem_version.rb +++ b/activejob/lib/active_job/gem_version.rb @@ -8,9 +8,9 @@ module ActiveJob module VERSION MAJOR = 7 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "rc1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md index ba7cc89b557..16701b065e7 100644 --- a/activemodel/CHANGELOG.md +++ b/activemodel/CHANGELOG.md @@ -1,217 +1,2 @@ -## Rails 7.1.0.rc1 (September 27, 2023) ## -* Remove change in the typography of user facing error messages. - For example, “can’t be blank” is again “can't be blank”. - - *Rafael Mendonça França* - - -## Rails 7.1.0.beta1 (September 13, 2023) ## - -* Support composite identifiers in `to_key` - - `to_key` avoids wrapping `#id` value into an `Array` if `#id` already an array - - *Nikita Vasilevsky* - -* Add `ActiveModel::Conversion.param_delimiter` to configure delimiter being used in `to_param` - - *Nikita Vasilevsky* - -* `undefine_attribute_methods` undefines alias attribute methods along with attribute methods. - - *Nikita Vasilevsky* - -* Error.full_message now strips ":base" from the message. - - *zzak* - -* Add a load hook for `ActiveModel::Model` (named `active_model`) to match the load hook for - `ActiveRecord::Base` and allow for overriding aspects of the `ActiveModel::Model` class. - - *Lewis Buckley* - -* Improve password length validation in ActiveModel::SecurePassword to consider byte size for BCrypt - compatibility. - - The previous password length validation only considered the character count, which may not - accurately reflect the 72-byte size limit imposed by BCrypt. This change updates the validation - to consider both character count and byte size while keeping the character length validation in place. - - ```ruby - user = User.new(password: "a" * 73) # 73 characters - user.valid? # => false - user.errors[:password] # => ["is too long"] - - - user = User.new(password: "あ" * 25) # 25 characters, 75 bytes - user.valid? # => false - user.errors[:password] # => ["is too long"] - ``` - - *ChatGPT*, *Guillermo Iguaran* - -* `has_secure_password` now generates an `#{attribute}_salt` method that returns the salt - used to compute the password digest. The salt will change whenever the password is changed, - so it can be used to create single-use password reset tokens with `generates_token_for`: - - ```ruby - class User < ActiveRecord::Base - has_secure_password - - generates_token_for :password_reset, expires_in: 15.minutes do - password_salt&.last(10) - end - end - ``` - - *Lázaro Nixon* - -* Improve typography of user facing error messages. In English contractions, - the Unicode APOSTROPHE (`U+0027`) is now RIGHT SINGLE QUOTATION MARK - (`U+2019`). For example, "can't be blank" is now "can’t be blank". - - *Jon Dufresne* - -* Add class to `ActiveModel::MissingAttributeError` error message. - - Show which class is missing the attribute in the error message: - - ```ruby - user = User.first - user.pets.select(:id).first.user_id - # => ActiveModel::MissingAttributeError: missing attribute 'user_id' for Pet - ``` - - *Petrik de Heus* - -* Raise `NoMethodError` in `ActiveModel::Type::Value#as_json` to avoid unpredictable - results. - - *Vasiliy Ermolovich* - -* Custom attribute types that inherit from Active Model built-in types and do - not override the `serialize` method will now benefit from an optimization - when serializing attribute values for the database. - - For example, with a custom type like the following: - - ```ruby - class DowncasedString < ActiveModel::Type::String - def cast(value) - super&.downcase - end - end - - ActiveRecord::Type.register(:downcased_string, DowncasedString) - - class User < ActiveRecord::Base - attribute :email, :downcased_string - end - - user = User.new(email: "FooBar@example.com") - ``` - - Serializing the `email` attribute for the database will be roughly twice as - fast. More expensive `cast` operations will likely see greater improvements. - - *Jonathan Hefner* - -* `has_secure_password` now supports password challenges via a - `password_challenge` accessor and validation. - - A password challenge is a safeguard to verify that the current user is - actually the password owner. It can be used when changing sensitive model - fields, such as the password itself. It is different than a password - confirmation, which is used to prevent password typos. - - When `password_challenge` is set, the validation checks that the value's - digest matches the *currently persisted* `password_digest` (i.e. - `password_digest_was`). - - This allows a password challenge to be done as part of a typical `update` - call, just like a password confirmation. It also allows a password - challenge error to be handled in the same way as other validation errors. - - For example, in the controller, instead of: - - ```ruby - password_params = params.require(:password).permit( - :password_challenge, - :password, - :password_confirmation, - ) - - password_challenge = password_params.delete(:password_challenge) - @password_challenge_failed = !current_user.authenticate(password_challenge) - - if !@password_challenge_failed && current_user.update(password_params) - # ... - end - ``` - - You can now write: - - ```ruby - password_params = params.require(:password).permit( - :password_challenge, - :password, - :password_confirmation, - ).with_defaults(password_challenge: "") - - if current_user.update(password_params) - # ... - end - ``` - - And, in the view, instead of checking `@password_challenge_failed`, you can - render an error for the `password_challenge` field just as you would for - other form fields, including utilizing `config.action_view.field_error_proc`. - - *Jonathan Hefner* - -* Support infinite ranges for `LengthValidator`s `:in`/`:within` options - - ```ruby - validates_length_of :first_name, in: ..30 - ``` - - *fatkodima* - -* Add support for beginless ranges to inclusivity/exclusivity validators: - - ```ruby - validates_inclusion_of :birth_date, in: -> { (..Date.today) } - ``` - - ```ruby - validates_exclusion_of :birth_date, in: -> { (..Date.today) } - ``` - - *Bo Jeanes* - -* Make validators accept lambdas without record argument - - ```ruby - # Before - validates_comparison_of :birth_date, less_than_or_equal_to: ->(_record) { Date.today } - - # After - validates_comparison_of :birth_date, less_than_or_equal_to: -> { Date.today } - ``` - - *fatkodima* - -* Fix casting long strings to `Date`, `Time` or `DateTime` - - *fatkodima* - -* Use different cache namespace for proxy calls - - Models can currently have different attribute bodies for the same method - names, leading to conflicts. Adding a new namespace `:active_model_proxy` - fixes the issue. - - *Chris Salzberg* - -Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/activemodel/CHANGELOG.md) for previous changes. +Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/activemodel/CHANGELOG.md) for previous changes. diff --git a/activemodel/lib/active_model/gem_version.rb b/activemodel/lib/active_model/gem_version.rb index 8bdba679efe..d1d8f256d1d 100644 --- a/activemodel/lib/active_model/gem_version.rb +++ b/activemodel/lib/active_model/gem_version.rb @@ -8,9 +8,9 @@ module ActiveModel module VERSION MAJOR = 7 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "rc1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 358424afabc..e54105e6580 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,2244 +1,2 @@ -## Rails 7.1.0.rc1 (September 27, 2023) ## -* Better naming for unique constraints support. - - Naming unique keys leads to misunderstanding it's a short-hand of unique indexes. - Just naming it unique constraints is not misleading. - - In Rails 7.1.0.beta1 or before: - - ```ruby - add_unique_key :sections, [:position], deferrable: :deferred, name: "unique_section_position" - remove_unique_key :sections, name: "unique_section_position" - ``` - - Now: - - ```ruby - add_unique_constraint :sections, [:position], deferrable: :deferred, name: "unique_section_position" - remove_unique_constraint :sections, name: "unique_section_position" - ``` - - *Ryuta Kamizono* - -* Fix duplicate quoting for check constraint expressions in schema dump when using MySQL - - A check constraint with an expression, that already contains quotes, lead to an invalid schema - dump with the mysql2 adapter. - - Fixes #42424. - - *Felix Tscheulin* - -* Performance tune the SQLite3 adapter connection configuration - - For Rails applications, the Write-Ahead-Log in normal syncing mode with a capped journal size, a healthy shared memory buffer and a shared cache will perform, on average, 2× better. - - *Stephen Margheim* - -* Allow SQLite3 `busy_handler` to be configured with simple max number of `retries` - - Retrying busy connections without delay is a preferred practice for performance-sensitive applications. Add support for a `database.yml` `retries` integer, which is used in a simple `busy_handler` function to retry busy connections without exponential backoff up to the max number of `retries`. - - *Stephen Margheim* - -* The SQLite3 adapter now supports `supports_insert_returning?` - - Implementing the full `supports_insert_returning?` contract means the SQLite3 adapter supports auto-populated columns (#48241) as well as custom primary keys. - - *Stephen Margheim* - -* Ensure the SQLite3 adapter handles default functions with the `||` concatenation operator - - Previously, this default function would produce the static string `"'Ruby ' || 'on ' || 'Rails'"`. - Now, the adapter will appropriately receive and use `"Ruby on Rails"`. - - ```ruby - change_column_default "test_models", "ruby_on_rails", -> { "('Ruby ' || 'on ' || 'Rails')" } - ``` - - *Stephen Margheim* - -* Dump PostgreSQL schemas as part of the schema dump. - - *Lachlan Sylvester* - - -## Rails 7.1.0.beta1 (September 13, 2023) ## - -* Encryption now supports `support_unencrypted_data` being set per-attribute. - - You can now opt out of `support_unencrypted_data` on a specific encrypted attribute. - This only has an effect if `ActiveRecord::Encryption.config.support_unencrypted_data == true`. - - ```ruby - class User < ActiveRecord::Base - encrypts :name, deterministic: true, support_unencrypted_data: false - encrypts :email, deterministic: true - end - ``` - - *Alex Ghiculescu* - -* Add instrumentation for Active Record transactions - - Allows subscribing to transaction events for tracking/instrumentation. The event payload contains the connection and the outcome (commit, rollback, restart, incomplete), as well as timing details. - - ```ruby - ActiveSupport::Notifications.subscribe("transaction.active_record") do |event| - puts "Transaction event occurred!" - connection = event.payload[:connection] - puts "Connection: #{connection.inspect}" - end - ``` - - *Daniel Colson*, *Ian Candy* - -* Support composite foreign keys via migration helpers. - - ```ruby - # Assuming "carts" table has "(shop_id, user_id)" as a primary key. - - add_foreign_key(:orders, :carts, primary_key: [:shop_id, :user_id]) - - remove_foreign_key(:orders, :carts, primary_key: [:shop_id, :user_id]) - foreign_key_exists?(:orders, :carts, primary_key: [:shop_id, :user_id]) - ``` - - *fatkodima* - -* Adds support for `if_not_exists` when adding a check constraint. - - ```ruby - add_check_constraint :posts, "post_type IN ('blog', 'comment', 'share')", if_not_exists: true - ``` - - *Cody Cutrer* - -* Raise an `ArgumentError` when `#accepts_nested_attributes_for` is declared more than once for an association in - the same class. Previously, the last declaration would silently override the previous one. Overriding in a subclass - is still allowed. - - *Joshua Young* - -* Deprecate `rewhere` argument on `#merge`. - - The `rewhere` argument on `#merge`is deprecated without replacement and - will be removed in Rails 7.2. - - *Adam Hess* - -* Fix unscope is not working in specific case - - Before: - ```ruby - Post.where(id: 1...3).unscope(where: :id).to_sql # "SELECT `posts`.* FROM `posts` WHERE `posts`.`id` >= 1 AND `posts`.`id` < 3" - - ``` - - After: - ```ruby - Post.where(id: 1...3).unscope(where: :id).to_sql # "SELECT `posts`.* FROM `posts`" - ``` - - Fixes #48094. - - *Kazuya Hatanaka* - -* Change `has_secure_token` default to `on: :initialize` - - Change the new default value from `on: :create` to `on: :initialize` - - Can be controlled by the `config.active_record.generate_secure_token_on` - configuration: - - ```ruby - config.active_record.generate_secure_token_on = :create - ``` - - *Sean Doyle* - -* Fix `change_column` not setting `precision: 6` on `datetime` columns when - using 7.0+ Migrations and SQLite. - - *Hartley McGuire* - -* Support composite identifiers in `to_key` - - `to_key` avoids wrapping `#id` value into an `Array` if `#id` already an array - - *Nikita Vasilevsky* - -* Add validation option for `enum` - - ```ruby - class Contract < ApplicationRecord - enum :status, %w[in_progress completed], validate: true - end - Contract.new(status: "unknown").valid? # => false - Contract.new(status: nil).valid? # => false - Contract.new(status: "completed").valid? # => true - - class Contract < ApplicationRecord - enum :status, %w[in_progress completed], validate: { allow_nil: true } - end - Contract.new(status: "unknown").valid? # => false - Contract.new(status: nil).valid? # => true - Contract.new(status: "completed").valid? # => true - ``` - - *Edem Topuzov*, *Ryuta Kamizono* - -* Allow batching methods to use already loaded relation if available - - Calling batch methods on already loaded relations will use the records previously loaded instead of retrieving - them from the database again. - - *Adam Hess* - -* Deprecate `read_attribute(:id)` returning the primary key if the primary key is not `:id`. - - Starting in Rails 7.2, `read_attribute(:id)` will return the value of the id column, regardless of the model's - primary key. To retrieve the value of the primary key, use `#id` instead. `read_attribute(:id)` for composite - primary key models will now return the value of the id column. - - *Adrianna Chang* - -* Fix `change_table` setting datetime precision for 6.1 Migrations - - *Hartley McGuire* - -* Fix change_column setting datetime precision for 6.1 Migrations - - *Hartley McGuire* - -* Add `ActiveRecord::Base#id_value` alias to access the raw value of a record's id column. - - This alias is only provided for models that declare an `:id` column. - - *Adrianna Chang* - -* Fix previous change tracking for `ActiveRecord::Store` when using a column with JSON structured database type - - Before, the methods to access the changes made during the last save `#saved_change_to_key?`, `#saved_change_to_key`, and `#key_before_last_save` did not work if the store was defined as a `store_accessor` on a column with a JSON structured database type - - *Robert DiMartino* - -* Fully support `NULLS [NOT] DISTINCT` for PostgreSQL 15+ indexes. - - Previous work was done to allow the index to be created in a migration, but it was not - supported in schema.rb. Additionally, the matching for `NULLS [NOT] DISTINCT` was not - in the correct order, which could have resulted in inconsistent schema detection. - - *Gregory Jones* - -* Allow escaping of literal colon characters in `sanitize_sql_*` methods when named bind variables are used - - *Justin Bull* - -* Fix `#previously_new_record?` to return true for destroyed records. - - Before, if a record was created and then destroyed, `#previously_new_record?` would return true. - Now, any UPDATE or DELETE to a record is considered a change, and will result in `#previously_new_record?` - returning false. - - *Adrianna Chang* - -* Specify callback in `has_secure_token` - - ```ruby - class User < ApplicationRecord - has_secure_token on: :initialize - end - - User.new.token # => "abc123...." - ``` - - *Sean Doyle* - -* Fix incrementation of in memory counter caches when associations overlap - - When two associations had a similarly named counter cache column, Active Record - could sometime increment the wrong one. - - *Jacopo Beschi*, *Jean Boussier* - -* Don't show secrets for Active Record's `Cipher::Aes256Gcm#inspect`. - - Before: - - ```ruby - ActiveRecord::Encryption::Cipher::Aes256Gcm.new(secret).inspect - "#<%= html_escape_once("this & that & the other") %>
- ``` - - Before this change, that would be double-escaped and render as: - - ```html -this & that & the other
- ``` - - After this change, it renders correctly as: - - ```html -this & that & the other
- ``` - - Fixes #48256 - - *Mike Dalessio* - -* Deprecate `SafeBuffer#clone_empty`. - - This method has not been used internally since Rails 4.2.0. - - *Mike Dalessio* - -* `MessageEncryptor`, `MessageVerifier`, and `config.active_support.message_serializer` - now accept `:message_pack` and `:message_pack_allow_marshal` as serializers. - These serializers require the [`msgpack` gem](https://rubygems.org/gems/msgpack) - (>= 1.7.0). - - The Message Pack format can provide improved performance and smaller payload - sizes. It also supports round-tripping some Ruby types that are not supported - by JSON. For example: - - ```ruby - verifier = ActiveSupport::MessageVerifier.new("secret") - data = [{ a: 1 }, { b: 2 }.with_indifferent_access, 1.to_d, Time.at(0, 123)] - message = verifier.generate(data) - - # BEFORE with config.active_support.message_serializer = :json - verifier.verified(message) - # => [{"a"=>1}, {"b"=>2}, "1.0", "1969-12-31T18:00:00.000-06:00"] - verifier.verified(message).map(&:class) - # => [Hash, Hash, String, String] - - # AFTER with config.active_support.message_serializer = :message_pack - verifier.verified(message) - # => [{:a=>1}, {"b"=>2}, 0.1e1, 1969-12-31 18:00:00.000123 -0600] - verifier.verified(message).map(&:class) - # => [Hash, ActiveSupport::HashWithIndifferentAccess, BigDecimal, Time] - ``` - - The `:message_pack` serializer can fall back to deserializing with - `ActiveSupport::JSON` when necessary, and the `:message_pack_allow_marshal` - serializer can fall back to deserializing with `Marshal` as well as - `ActiveSupport::JSON`. Additionally, the `:marshal`, `:json`, and - `:json_allow_marshal` serializers can now fall back to deserializing with - `ActiveSupport::MessagePack` when necessary. These behaviors ensure old - messages can still be read so that migration is easier. - - *Jonathan Hefner* - -* A new `7.1` cache format is available which includes an optimization for - bare string values such as view fragments. - - The `7.1` cache format is used by default for new apps, and existing apps - can enable the format by setting `config.load_defaults 7.1` or by setting - `config.active_support.cache_format_version = 7.1` in `config/application.rb` - or a `config/environments/*.rb` file. - - Cache entries written using the `6.1` or `7.0` cache formats can be read - when using the `7.1` format. To perform a rolling deploy of a Rails 7.1 - upgrade, wherein servers that have not yet been upgraded must be able to - read caches from upgraded servers, leave the cache format unchanged on the - first deploy, then enable the `7.1` cache format on a subsequent deploy. - - *Jonathan Hefner* - -* Active Support cache stores can now use a preconfigured serializer based on - `ActiveSupport::MessagePack` via the `:serializer` option: - - ```ruby - config.cache_store = :redis_cache_store, { serializer: :message_pack } - ``` - - The `:message_pack` serializer can reduce cache entry sizes and improve - performance, but requires the [`msgpack` gem](https://rubygems.org/gems/msgpack) - (>= 1.7.0). - - The `:message_pack` serializer can read cache entries written by the default - serializer, and the default serializer can now read entries written by the - `:message_pack` serializer. These behaviors make it easy to migrate between - serializer without invalidating the entire cache. - - *Jonathan Hefner* - -* `Object#deep_dup` no longer duplicate named classes and modules. - - Before: - - ```ruby - hash = { class: Object, module: Kernel } - hash.deep_dup # => {:class=>#- These are the new guides for Rails 7.1 based on <%= @version %>. + These are the new guides for Rails 7.2 based on <%= @version %>. These guides are designed to make you immediately productive with Rails, and to help you understand how all of the pieces fit together.
<% end %>
The guides for earlier releases:
+Rails 7.1,
Rails 7.0,
Rails 6.1,
Rails 6.0,
diff --git a/guides/source/active_record_basics.md b/guides/source/active_record_basics.md
index 8f11320b768..11c7d3b3377 100644
--- a/guides/source/active_record_basics.md
+++ b/guides/source/active_record_basics.md
@@ -410,7 +410,7 @@ in files which are executed against any database that Active Record supports.
Here's a migration that creates a new table called `publications`:
```ruby
-class CreatePublications < ActiveRecord::Migration[7.1]
+class CreatePublications < ActiveRecord::Migration[7.2]
def change
create_table :publications do |t|
t.string :title
diff --git a/guides/source/active_record_composite_primary_keys.md b/guides/source/active_record_composite_primary_keys.md
index 1bef356d94d..d4e681034b1 100644
--- a/guides/source/active_record_composite_primary_keys.md
+++ b/guides/source/active_record_composite_primary_keys.md
@@ -36,7 +36,7 @@ You can create a table with a composite primary key by passing the
`:primary_key` option to `create_table` with an array value:
```ruby
-class CreateProducts < ActiveRecord::Migration[7.1]
+class CreateProducts < ActiveRecord::Migration[7.2]
def change
create_table :products, primary_key: [:store_id, :sku] do |t|
t.integer :store_id
diff --git a/guides/source/active_record_migrations.md b/guides/source/active_record_migrations.md
index a6e39253e79..ad1d353d98c 100644
--- a/guides/source/active_record_migrations.md
+++ b/guides/source/active_record_migrations.md
@@ -34,7 +34,7 @@ history to the latest version. Active Record will also update your
Here's an example of a migration:
```ruby
-class CreateProducts < ActiveRecord::Migration[7.1]
+class CreateProducts < ActiveRecord::Migration[7.2]
def change
create_table :products do |t|
t.string :name
@@ -73,7 +73,7 @@ If you wish for a migration to do something that Active Record doesn't know how
to reverse, you can use `reversible`:
```ruby
-class ChangeProductsPrice < ActiveRecord::Migration[7.1]
+class ChangeProductsPrice < ActiveRecord::Migration[7.2]
def change
reversible do |direction|
change_table :products do |t|
@@ -92,7 +92,7 @@ passed to `direction.up` and `direction.down` respectively.
Alternatively, you can use `up` and `down` instead of `change`:
```ruby
-class ChangeProductsPrice < ActiveRecord::Migration[7.1]
+class ChangeProductsPrice < ActiveRecord::Migration[7.2]
def up
change_table :products do |t|
t.change :price, :string
@@ -136,7 +136,7 @@ $ bin/rails generate migration AddPartNumberToProducts
This will create an appropriately named empty migration:
```ruby
-class AddPartNumberToProducts < ActiveRecord::Migration[7.1]
+class AddPartNumberToProducts < ActiveRecord::Migration[7.2]
def change
end
end
@@ -160,7 +160,7 @@ $ bin/rails generate migration AddPartNumberToProducts part_number:string
This will generate the following migration:
```ruby
-class AddPartNumberToProducts < ActiveRecord::Migration[7.1]
+class AddPartNumberToProducts < ActiveRecord::Migration[7.2]
def change
add_column :products, :part_number, :string
end
@@ -176,7 +176,7 @@ $ bin/rails generate migration AddPartNumberToProducts part_number:string:index
This will generate the appropriate [`add_column`][] and [`add_index`][] statements:
```ruby
-class AddPartNumberToProducts < ActiveRecord::Migration[7.1]
+class AddPartNumberToProducts < ActiveRecord::Migration[7.2]
def change
add_column :products, :part_number, :string
add_index :products, :part_number
@@ -194,7 +194,7 @@ Will generate a schema migration which adds two additional
columns to the `products` table.
```ruby
-class AddDetailsToProducts < ActiveRecord::Migration[7.1]
+class AddDetailsToProducts < ActiveRecord::Migration[7.2]
def change
add_column :products, :part_number, :string
add_column :products, :price, :decimal
@@ -213,7 +213,7 @@ $ bin/rails generate migration RemovePartNumberFromProducts part_number:string
This generates the appropriate [`remove_column`][] statements:
```ruby
-class RemovePartNumberFromProducts < ActiveRecord::Migration[7.1]
+class RemovePartNumberFromProducts < ActiveRecord::Migration[7.2]
def change
remove_column :products, :part_number, :string
end
@@ -233,7 +233,7 @@ $ bin/rails generate migration CreateProducts name:string part_number:string
generates
```ruby
-class CreateProducts < ActiveRecord::Migration[7.1]
+class CreateProducts < ActiveRecord::Migration[7.2]
def change
create_table :products do |t|
t.string :name
@@ -261,7 +261,7 @@ $ bin/rails generate migration AddUserRefToProducts user:references
generates the following [`add_reference`][] call:
```ruby
-class AddUserRefToProducts < ActiveRecord::Migration[7.1]
+class AddUserRefToProducts < ActiveRecord::Migration[7.2]
def change
add_reference :products, :user, foreign_key: true
end
@@ -281,7 +281,7 @@ $ bin/rails generate migration CreateJoinTableCustomerProduct customer product
will produce the following migration:
```ruby
-class CreateJoinTableCustomerProduct < ActiveRecord::Migration[7.1]
+class CreateJoinTableCustomerProduct < ActiveRecord::Migration[7.2]
def change
create_join_table :customers, :products do |t|
# t.index [:customer_id, :product_id]
@@ -310,7 +310,7 @@ $ bin/rails generate model Product name:string description:text
This will create a migration that looks like this:
```ruby
-class CreateProducts < ActiveRecord::Migration[7.1]
+class CreateProducts < ActiveRecord::Migration[7.2]
def change
create_table :products do |t|
t.string :name
@@ -338,7 +338,7 @@ $ bin/rails generate migration AddDetailsToProducts 'price:decimal{5,2}' supplie
will produce a migration that looks like this
```ruby
-class AddDetailsToProducts < ActiveRecord::Migration[7.1]
+class AddDetailsToProducts < ActiveRecord::Migration[7.2]
def change
add_column :products, :price, :decimal, precision: 5, scale: 2
add_reference :products, :supplier, polymorphic: true
@@ -635,7 +635,7 @@ You can create a table with a composite primary key by passing the
`:primary_key` option to `create_table` with an array value:
```ruby
-class CreateProducts < ActiveRecord::Migration[7.1]
+class CreateProducts < ActiveRecord::Migration[7.2]
def change
create_table :products, primary_key: [:customer_id, :product_sku] do |t|
t.integer :customer_id
@@ -744,7 +744,7 @@ reverse. You can use [`reversible`][] to specify what to do when running a
migration and what else to do when reverting it. For example:
```ruby
-class ExampleMigration < ActiveRecord::Migration[7.1]
+class ExampleMigration < ActiveRecord::Migration[7.2]
def change
create_table :distributors do |t|
t.string :zipcode
@@ -795,7 +795,7 @@ reverse order they were made in the `up` method. The example in the `reversible`
section is equivalent to:
```ruby
-class ExampleMigration < ActiveRecord::Migration[7.1]
+class ExampleMigration < ActiveRecord::Migration[7.2]
def up
create_table :distributors do |t|
t.string :zipcode
@@ -843,7 +843,7 @@ You can use Active Record's ability to rollback migrations using the [`revert`][
```ruby
require_relative "20121212123456_example_migration"
-class FixupExampleMigration < ActiveRecord::Migration[7.1]
+class FixupExampleMigration < ActiveRecord::Migration[7.2]
def change
revert ExampleMigration
@@ -861,7 +861,7 @@ For example, let's imagine that `ExampleMigration` is committed and it is later
decided that a Distributors view is no longer needed.
```ruby
-class DontUseDistributorsViewMigration < ActiveRecord::Migration[7.1]
+class DontUseDistributorsViewMigration < ActiveRecord::Migration[7.2]
def change
revert do
# copy-pasted code from ExampleMigration
@@ -1039,7 +1039,7 @@ Several methods are provided in migrations that allow you to control all this:
For example, take the following migration:
```ruby
-class CreateProducts < ActiveRecord::Migration[7.1]
+class CreateProducts < ActiveRecord::Migration[7.2]
def change
suppress_messages do
create_table :products do |t|
@@ -1144,7 +1144,7 @@ When `:ruby` is selected, then the schema is stored in `db/schema.rb`. If you lo
at this file you'll find that it looks an awful lot like one very big migration:
```ruby
-ActiveRecord::Schema[7.1].define(version: 2008_09_06_171750) do
+ActiveRecord::Schema[7.2].define(version: 2008_09_06_171750) do
create_table "authors", force: true do |t|
t.string "name"
t.datetime "created_at"
@@ -1229,7 +1229,7 @@ modify data. This is useful in an existing database that can't be destroyed and
recreated, such as a production database.
```ruby
-class AddInitialProducts < ActiveRecord::Migration[7.1]
+class AddInitialProducts < ActiveRecord::Migration[7.2]
def up
5.times do |i|
Product.create(name: "Product ##{i}", description: "A product.")
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index d40e440ab15..1075b94736d 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -112,7 +112,7 @@ NOTE: `belongs_to` associations _must_ use the singular term. If you used the pl
The corresponding migration might look like this:
```ruby
-class CreateBooks < ActiveRecord::Migration[7.1]
+class CreateBooks < ActiveRecord::Migration[7.2]
def change
create_table :authors do |t|
t.string :name
@@ -159,7 +159,7 @@ The main difference from `belongs_to` is that the link column `supplier_id` is l
The corresponding migration might look like this:
```ruby
-class CreateSuppliers < ActiveRecord::Migration[7.1]
+class CreateSuppliers < ActiveRecord::Migration[7.2]
def change
create_table :suppliers do |t|
t.string :name
@@ -205,7 +205,7 @@ NOTE: The name of the other model is pluralized when declaring a `has_many` asso
The corresponding migration might look like this:
```ruby
-class CreateAuthors < ActiveRecord::Migration[7.1]
+class CreateAuthors < ActiveRecord::Migration[7.2]
def change
create_table :authors do |t|
t.string :name
@@ -257,7 +257,7 @@ end
The corresponding migration might look like this:
```ruby
-class CreateAppointments < ActiveRecord::Migration[7.1]
+class CreateAppointments < ActiveRecord::Migration[7.2]
def change
create_table :physicians do |t|
t.string :name
@@ -343,7 +343,7 @@ end
The corresponding migration might look like this:
```ruby
-class CreateAccountHistories < ActiveRecord::Migration[7.1]
+class CreateAccountHistories < ActiveRecord::Migration[7.2]
def change
create_table :suppliers do |t|
t.string :name
@@ -386,7 +386,7 @@ end
The corresponding migration might look like this:
```ruby
-class CreateAssembliesAndParts < ActiveRecord::Migration[7.1]
+class CreateAssembliesAndParts < ActiveRecord::Migration[7.2]
def change
create_table :assemblies do |t|
t.string :name
@@ -425,7 +425,7 @@ end
The corresponding migration might look like this:
```ruby
-class CreateSuppliers < ActiveRecord::Migration[7.1]
+class CreateSuppliers < ActiveRecord::Migration[7.2]
def change
create_table :suppliers do |t|
t.string :name
@@ -510,7 +510,7 @@ Similarly, you can retrieve `@product.pictures`.
If you have an instance of the `Picture` model, you can get to its parent via `@picture.imageable`. To make this work, you need to declare both a foreign key column and a type column in the model that declares the polymorphic interface:
```ruby
-class CreatePictures < ActiveRecord::Migration[7.1]
+class CreatePictures < ActiveRecord::Migration[7.2]
def change
create_table :pictures do |t|
t.string :name
@@ -527,7 +527,7 @@ end
This migration can be simplified by using the `t.references` form:
```ruby
-class CreatePictures < ActiveRecord::Migration[7.1]
+class CreatePictures < ActiveRecord::Migration[7.2]
def change
create_table :pictures do |t|
t.string :name
@@ -622,7 +622,7 @@ With this setup, you can retrieve `@employee.subordinates` and `@employee.manage
In your migrations/schema, you will add a references column to the model itself.
```ruby
-class CreateEmployees < ActiveRecord::Migration[7.1]
+class CreateEmployees < ActiveRecord::Migration[7.2]
def change
create_table :employees do |t|
t.references :manager, foreign_key: { to_table: :employees }
@@ -696,7 +696,7 @@ end
This declaration needs to be backed up by a corresponding foreign key column in the books table. For a brand new table, the migration might look something like this:
```ruby
-class CreateBooks < ActiveRecord::Migration[7.1]
+class CreateBooks < ActiveRecord::Migration[7.2]
def change
create_table :books do |t|
t.datetime :published_at
@@ -710,7 +710,7 @@ end
Whereas for an existing table, it might look like this:
```ruby
-class AddAuthorToBooks < ActiveRecord::Migration[7.1]
+class AddAuthorToBooks < ActiveRecord::Migration[7.2]
def change
add_reference :books, :author
end
@@ -742,7 +742,7 @@ end
These need to be backed up by a migration to create the `assemblies_parts` table. This table should be created without a primary key:
```ruby
-class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[7.1]
+class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[7.2]
def change
create_table :assemblies_parts, id: false do |t|
t.bigint :assembly_id
@@ -760,7 +760,7 @@ We pass `id: false` to `create_table` because that table does not represent a mo
For simplicity, you can also use the method `create_join_table`:
```ruby
-class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[7.1]
+class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[7.2]
def change
create_join_table :assemblies, :parts do |t|
t.index :assembly_id
diff --git a/guides/source/command_line.md b/guides/source/command_line.md
index ead3642ab9c..5e0493e6e95 100644
--- a/guides/source/command_line.md
+++ b/guides/source/command_line.md
@@ -410,7 +410,7 @@ If you wish to test out some code without changing any data, you can do that by
```bash
$ bin/rails console --sandbox
-Loading development environment in sandbox (Rails 7.1.0)
+Loading development environment in sandbox (Rails 7.2.0)
Any modifications you make will be rolled back on exit
irb(main):001:0>
```
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index c31e19ca3b8..0eb985f7fa6 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -614,7 +614,7 @@ To ease the upgrade it's required to add the new default to the
value:
```ruby
-# new_framework_defaults_7_1.rb.tt
+# new_framework_defaults_7_2.rb.tt
# Rails.application.config.active_job.existing_behavior = false
```
diff --git a/guides/source/debugging_rails_applications.md b/guides/source/debugging_rails_applications.md
index 8c6817ab4d5..64a34893928 100644
--- a/guides/source/debugging_rails_applications.md
+++ b/guides/source/debugging_rails_applications.md
@@ -378,7 +378,7 @@ Processing by PostsController#index as HTML
10| # GET /posts/1 or /posts/1.json
11| def show
=>#0 PostsController#index at ~/projects/rails-guide-example/app/controllers/posts_controller.rb:7
- #1 ActionController::BasicImplicitRender#send_action(method="index", args=[]) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actionpack-7.1.0.alpha/lib/action_controller/metal/basic_implicit_render.rb:6
+ #1 ActionController::BasicImplicitRender#send_action(method="index", args=[]) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actionpack-7.2.0.alpha/lib/action_controller/metal/basic_implicit_render.rb:6
# and 72 frames (use `bt' command for all frames)
(rdbg)
```
@@ -444,14 +444,14 @@ When used without any options, `backtrace` lists all the frames on the stack:
```rb
=>#0 PostsController#index at ~/projects/rails-guide-example/app/controllers/posts_controller.rb:7
- #1 ActionController::BasicImplicitRender#send_action(method="index", args=[]) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actionpack-7.1.0.alpha/lib/action_controller/metal/basic_implicit_render.rb:6
- #2 AbstractController::Base#process_action(method_name="index", args=[]) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actionpack-7.1.0.alpha/lib/abstract_controller/base.rb:214
- #3 ActionController::Rendering#process_action(#arg_rest=nil) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actionpack-7.1.0.alpha/lib/action_controller/metal/rendering.rb:53
- #4 block in process_action at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actionpack-7.1.0.alpha/lib/abstract_controller/callbacks.rb:221
- #5 block in run_callbacks at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/activesupport-7.1.0.alpha/lib/active_support/callbacks.rb:118
- #6 ActionText::Rendering::ClassMethods#with_renderer(renderer=#