DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.
Highlights in 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.
TODO: Add description #46762
TODO: Add description #43945
TODO: Add description #44189
TODO: Add description #46603
TODO: Add description
TODO: Add description #47880
TODO: Add description #47770
TODO: Add description #48572
TODO: Add description #44446
TODO: #45602
TODO: #46049
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 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/ }] } }
Please refer to the Changelog for detailed changes.
Please refer to the Changelog for detailed changes.
Please refer to the Changelog for detailed changes.
-
Remove deprecated behavior on
Request#content_type
-
Remove deprecated ability to assign a single value to
config.action_dispatch.trusted_proxies
. -
Remove deprecated
poltergeist
andwebkit
(capybara-webkit) driver registration for system testing.
-
Deprecate
config.action_dispatch.return_only_request_media_type_on_content_type
. -
Deprecate
AbstractController::Helpers::MissingHelperError
-
Deprecate
ActionDispatch::IllegalStateError
.
Please refer to the Changelog for detailed changes.
-
Remove deprecated constant
ActionView::Path
. -
Remove deprecated support to passing instance variables as locals to partials.
Please refer to the Changelog for detailed changes.
Please refer to the Changelog for detailed changes.
-
Remove support for
ActiveRecord.legacy_connection_handling
. -
Remove deprecated
ActiveRecord::Base
config accessors -
Remove support for
:include_replicas
onconfigs_for
. Use:include_hidden
instead. -
Remove deprecated
config.active_record.partial_writes
. -
Remove deprecated
Tasks::DatabaseTasks.schema_file_type
.
Please refer to the Changelog for detailed changes.
-
Remove deprecated invalid default content types in Active Storage configurations.
-
Remove deprecated
ActiveStorage::Current#host
andActiveStorage::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
andpurge_later
methods from the attachments association.
Please refer to the Changelog for detailed changes.
Please refer to the Changelog for detailed changes.
-
Remove deprecated override of
Enumerable#sum
. -
Remove deprecated
ActiveSupport::PerThreadRegistry
. -
Remove deprecated option to passing a format to
#to_s
inArray
,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
byActiveSupport::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
.
-
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
.
Please refer to the Changelog for detailed changes.
Please refer to the Changelog for detailed changes.
Please refer to the Changelog for detailed changes.
Please refer to the Changelog for detailed changes.
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.