Skip to content

Latest commit

 

History

History
352 lines (212 loc) · 9.87 KB

7_1_release_notes.md

File metadata and controls

352 lines (212 loc) · 9.87 KB

DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.

Ruby on Rails 7.1 Release Notes

Highlights in Rails 7.1:


Upgrading to Rails 7.1

If you're upgrading an existing application, it's a great idea to have good test coverage before going in. You should also first upgrade to Rails 7.0 in case you haven't and make sure your application still runs as expected before attempting an update to Rails 7.1. A list of things to watch out for when upgrading is available in the Upgrading Ruby on Rails guide.

Major Features

Add default Dockerfiles for Rails applications

TODO: Add description #46762

Add ActiveRecord::Base.normalizes

TODO: Add description #43945

Add ActiveRecord::Base.generates_token_for

TODO: Add description #44189

Add `perform_all_later`` to enqueue multiple jobs at once

TODO: Add description #46603

Composite primary keys

TODO: Add description

Introduce adapter for Trilogy

TODO: Add description #47880

Add ActiveSupport::MessagePack

TODO: Add description #47770

Introduce config.autoload_lib

TODO: Add description #48572

Active Record API for general async queries

TODO: Add description #44446

Allow templates to set strict locals.

TODO: #45602

Add Rails.application.deprecators

TODO: #46049

Support pattern matching for JSON response.parsed_body

When ActionDispatch::IntegrationTest tests blocks invoke response.parsed_body for JSON responses, their payloads will be available with indifferent access. This enables integration with Ruby's Pattern Matching, and built-in Minitest support for pattern matching:

get "/posts.json"

response.content_type         # => "application/json; charset=utf-8"
response.parsed_body.class    # => Array
response.parsed_body          # => [{"id"=>42, "title"=>"Title"},...

assert_pattern { response.parsed_body => [{ id: 42 }] }

get "/posts/42.json"

response.content_type         # => "application/json; charset=utf-8"
response.parsed_body.class    # => ActiveSupport::HashWithIndifferentAccess
response.parsed_body          # => {"id"=>42, "title"=>"Title"}

assert_pattern { response.parsed_body => [{ title: /title/i }] }

Extend response.parsed_body to parse HTML with Nokogiri

Extend the ActionDispatch::Testing module to support parsing the value of an HTML response.body into a Nokogiri::HTML5::Document instance:

get "/posts"

response.content_type         # => "text/html; charset=utf-8"
response.parsed_body.class    # => Nokogiri::HTML5::Document
response.parsed_body.to_html  # => "<!DOCTYPE html>\n<html>\n..."

Newly added Nokogiri support for pattern matching, along with built-in Minitest support for pattern matching presents opportunities to make test assertions about the structure and content of the HTML response:

get "/posts"

html = response.parsed_body # => <html>
                            #      <head></head>
                            #        <body>
                            #          <main><h1>Some main content</h1></main>
                            #        </body>
                            #     </html>

assert_pattern { html.at("main") => { content: "Some main content" } }
assert_pattern { html.at("main") => { content: /content/ } }
assert_pattern { html.at("main") => { children: [{ name: "h1", content: /content/ }] } }

Railties

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action Cable

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action Pack

Please refer to the Changelog for detailed changes.

Removals

  • Remove deprecated behavior on Request#content_type

  • Remove deprecated ability to assign a single value to config.action_dispatch.trusted_proxies.

  • Remove deprecated poltergeist and webkit (capybara-webkit) driver registration for system testing.

Deprecations

  • Deprecate config.action_dispatch.return_only_request_media_type_on_content_type.

  • Deprecate AbstractController::Helpers::MissingHelperError

  • Deprecate ActionDispatch::IllegalStateError.

Notable changes

Action View

Please refer to the Changelog for detailed changes.

Removals

  • Remove deprecated constant ActionView::Path.

  • Remove deprecated support to passing instance variables as locals to partials.

Deprecations

Notable changes

Action Mailer

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Active Record

Please refer to the Changelog for detailed changes.

Removals

  • Remove support for ActiveRecord.legacy_connection_handling.

  • Remove deprecated ActiveRecord::Base config accessors

  • Remove support for :include_replicas on configs_for. Use :include_hidden instead.

  • Remove deprecated config.active_record.partial_writes.

  • Remove deprecated Tasks::DatabaseTasks.schema_file_type.

Deprecations

Notable changes

Active Storage

Please refer to the Changelog for detailed changes.

Removals

  • Remove deprecated invalid default content types in Active Storage configurations.

  • Remove deprecated ActiveStorage::Current#host and ActiveStorage::Current#host= methods.

  • Remove deprecated behavior when assigning to a collection of attachments. Instead of appending to the collection, the collection is now replaced.

  • Remove deprecated purge and purge_later methods from the attachments association.

Deprecations

Notable changes

Active Model

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Active Support

Please refer to the Changelog for detailed changes.

Removals

  • Remove deprecated override of Enumerable#sum.

  • Remove deprecated ActiveSupport::PerThreadRegistry.

  • Remove deprecated option to passing a format to #to_s in Array, Range, Date, DateTime, Time, BigDecimal, Float and, Integer.

  • Remove deprecated override of ActiveSupport::TimeWithZone.name.

  • Remove deprecated active_support/core_ext/uri file.

  • Remove deprecated active_support/core_ext/range/include_time_with_zone file.

  • Remove implicit conversion of objects into String by ActiveSupport::SafeBuffer.

  • Remove deprecated support to generate incorrect RFC 4122 UUIDs when providing a namespace ID that is not one of the constants defined on Digest::UUID.

Deprecations

  • Deprecate config.active_support.disable_to_s_conversion.

  • Deprecate config.active_support.remove_deprecated_time_with_zone_name.

  • Deprecate config.active_support.use_rfc4122_namespaced_uuids.

Notable changes

Active Job

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action Text

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action Mailbox

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Ruby on Rails Guides

Please refer to the Changelog for detailed changes.

Notable changes

Credits

See the full list of contributors to Rails for the many people who spent many hours making Rails, the stable and robust framework it is. Kudos to all of them.