Start development of Rails 8.1

This commit is contained in:
Rafael Mendonça França 2024-10-19 02:02:45 +00:00
parent 35b3c7f12b
commit 592ea10f8b
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
61 changed files with 565 additions and 1389 deletions

2
.github/stale.yml vendored
View File

@ -20,7 +20,7 @@ markComment: >
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the `7-2-stable` branch or on `main`,
If you can still reproduce this error on the `8-0-stable` branch or on `main`,
please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

View File

@ -29,29 +29,29 @@ GIT
PATH
remote: .
specs:
actioncable (8.0.0.rc1)
actionpack (= 8.0.0.rc1)
activesupport (= 8.0.0.rc1)
actioncable (8.1.0.alpha)
actionpack (= 8.1.0.alpha)
activesupport (= 8.1.0.alpha)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (8.0.0.rc1)
actionpack (= 8.0.0.rc1)
activejob (= 8.0.0.rc1)
activerecord (= 8.0.0.rc1)
activestorage (= 8.0.0.rc1)
activesupport (= 8.0.0.rc1)
actionmailbox (8.1.0.alpha)
actionpack (= 8.1.0.alpha)
activejob (= 8.1.0.alpha)
activerecord (= 8.1.0.alpha)
activestorage (= 8.1.0.alpha)
activesupport (= 8.1.0.alpha)
mail (>= 2.8.0)
actionmailer (8.0.0.rc1)
actionpack (= 8.0.0.rc1)
actionview (= 8.0.0.rc1)
activejob (= 8.0.0.rc1)
activesupport (= 8.0.0.rc1)
actionmailer (8.1.0.alpha)
actionpack (= 8.1.0.alpha)
actionview (= 8.1.0.alpha)
activejob (= 8.1.0.alpha)
activesupport (= 8.1.0.alpha)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (8.0.0.rc1)
actionview (= 8.0.0.rc1)
activesupport (= 8.0.0.rc1)
actionpack (8.1.0.alpha)
actionview (= 8.1.0.alpha)
activesupport (= 8.1.0.alpha)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
@ -59,35 +59,35 @@ PATH
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (8.0.0.rc1)
actionpack (= 8.0.0.rc1)
activerecord (= 8.0.0.rc1)
activestorage (= 8.0.0.rc1)
activesupport (= 8.0.0.rc1)
actiontext (8.1.0.alpha)
actionpack (= 8.1.0.alpha)
activerecord (= 8.1.0.alpha)
activestorage (= 8.1.0.alpha)
activesupport (= 8.1.0.alpha)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (8.0.0.rc1)
activesupport (= 8.0.0.rc1)
actionview (8.1.0.alpha)
activesupport (= 8.1.0.alpha)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (8.0.0.rc1)
activesupport (= 8.0.0.rc1)
activejob (8.1.0.alpha)
activesupport (= 8.1.0.alpha)
globalid (>= 0.3.6)
activemodel (8.0.0.rc1)
activesupport (= 8.0.0.rc1)
activerecord (8.0.0.rc1)
activemodel (= 8.0.0.rc1)
activesupport (= 8.0.0.rc1)
activemodel (8.1.0.alpha)
activesupport (= 8.1.0.alpha)
activerecord (8.1.0.alpha)
activemodel (= 8.1.0.alpha)
activesupport (= 8.1.0.alpha)
timeout (>= 0.4.0)
activestorage (8.0.0.rc1)
actionpack (= 8.0.0.rc1)
activejob (= 8.0.0.rc1)
activerecord (= 8.0.0.rc1)
activesupport (= 8.0.0.rc1)
activestorage (8.1.0.alpha)
actionpack (= 8.1.0.alpha)
activejob (= 8.1.0.alpha)
activerecord (= 8.1.0.alpha)
activesupport (= 8.1.0.alpha)
marcel (~> 1.0)
activesupport (8.0.0.rc1)
activesupport (8.1.0.alpha)
base64
benchmark (>= 0.3)
bigdecimal
@ -100,23 +100,23 @@ PATH
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
rails (8.0.0.rc1)
actioncable (= 8.0.0.rc1)
actionmailbox (= 8.0.0.rc1)
actionmailer (= 8.0.0.rc1)
actionpack (= 8.0.0.rc1)
actiontext (= 8.0.0.rc1)
actionview (= 8.0.0.rc1)
activejob (= 8.0.0.rc1)
activemodel (= 8.0.0.rc1)
activerecord (= 8.0.0.rc1)
activestorage (= 8.0.0.rc1)
activesupport (= 8.0.0.rc1)
rails (8.1.0.alpha)
actioncable (= 8.1.0.alpha)
actionmailbox (= 8.1.0.alpha)
actionmailer (= 8.1.0.alpha)
actionpack (= 8.1.0.alpha)
actiontext (= 8.1.0.alpha)
actionview (= 8.1.0.alpha)
activejob (= 8.1.0.alpha)
activemodel (= 8.1.0.alpha)
activerecord (= 8.1.0.alpha)
activestorage (= 8.1.0.alpha)
activesupport (= 8.1.0.alpha)
bundler (>= 1.15.0)
railties (= 8.0.0.rc1)
railties (8.0.0.rc1)
actionpack (= 8.0.0.rc1)
activesupport (= 8.0.0.rc1)
railties (= 8.1.0.alpha)
railties (8.1.0.alpha)
actionpack (= 8.1.0.alpha)
activesupport (= 8.1.0.alpha)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)

View File

@ -1 +1 @@
8.0.0.rc1
8.1.0.alpha

View File

@ -1,12 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* No changes.
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Add an `identifier` to the event payload for the ActiveSupport::Notification `transmit_subscription_confirmation.action_cable` and `transmit_subscription_rejection.action_cable`.
*Keith Schacht*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actioncable/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actioncable/CHANGELOG.md) for previous changes.

View File

@ -10,9 +10,9 @@ module ActionCable
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,6 +1,6 @@
{
"name": "@rails/actioncable",
"version": "8.0.0-rc1",
"version": "8.1.0-alpha",
"description": "WebSocket framework for Ruby on Rails.",
"module": "app/assets/javascripts/actioncable.esm.js",
"main": "app/assets/javascripts/actioncable.js",

View File

@ -1,9 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* No changes.
## Rails 8.0.0.beta1 (September 26, 2024) ##
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionmailbox/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actionmailbox/CHANGELOG.md) for previous changes.

View File

@ -8,9 +8,9 @@ module ActionMailbox
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2018_02_12_164506) do
ActiveRecord::Schema[8.1].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

View File

@ -1,9 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* No changes.
## Rails 8.0.0.beta1 (September 26, 2024) ##
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionmailer/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actionmailer/CHANGELOG.md) for previous changes.

View File

@ -8,9 +8,9 @@ module ActionMailer
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,172 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* Remove `Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`.
*Rafael Mendonça França*
* Improve `ActionController::TestCase` to expose a binary encoded `request.body`.
The rack spec clearly states:
> The input stream is an IO-like object which contains the raw HTTP POST data.
> When applicable, its external encoding must be “ASCII-8BIT” and it must be opened in binary mode.
Until now its encoding was generally UTF-8, which doesn't accurately reflect production
behavior.
*Jean Boussier*
* Update `ActionController::AllowBrowser` to support passing method names to `:block`
```ruby
class ApplicationController < ActionController::Base
allow_browser versions: :modern, block: :handle_outdated_browser
private
def handle_outdated_browser
render file: Rails.root.join("public/custom-error.html"), status: :not_acceptable
end
end
```
*Sean Doyle*
* Raise an `ArgumentError` when invalid `:only` or `:except` options are passed into `#resource` and `#resources`.
*Joshua Young*
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Fix non-GET requests not updating cookies in `ActionController::TestCase`.
*Jon Moss*, *Hartley McGuire*
* Update `ActionController::Live` to use a thread-pool to reuse threads across requests.
*Adam Renberg Tamm*
* Introduce safer, more explicit params handling method with `params#expect` such that
`params.expect(table: [ :attr ])` replaces `params.require(:table).permit(:attr)`
Ensures params are filtered with consideration for the expected
types of values, improving handling of params and avoiding ignorable
errors caused by params tampering.
```ruby
# If the url is altered to ?person=hacked
# Before
params.require(:person).permit(:name, :age, pets: [:name])
# raises NoMethodError, causing a 500 and potential error reporting
# After
params.expect(person: [ :name, :age, pets: [[:name]] ])
# raises ActionController::ParameterMissing, correctly returning a 400 error
```
You may also notice the new double array `[[:name]]`. In order to
declare when a param is expected to be an array of parameter hashes,
this new double array syntax is used to explicitly declare an array.
`expect` requires you to declare expected arrays in this way, and will
ignore arrays that are passed when, for example, `pet: [:name]` is used.
In order to preserve compatibility, `permit` does not adopt the new
double array syntax and is therefore more permissive about unexpected
types. Using `expect` everywhere is recommended.
We suggest replacing `params.require(:person).permit(:name, :age)`
with the direct replacement `params.expect(person: [:name, :age])`
to prevent external users from manipulating params to trigger 500
errors. A 400 error will be returned instead, using public/400.html
Usage of `params.require(:id)` should likewise be replaced with
`params.expect(:id)` which is designed to ensure that `params[:id]`
is a scalar and not an array or hash, also requiring the param.
```ruby
# Before
User.find(params.require(:id)) # allows an array, altering behavior
# After
User.find(params.expect(:id)) # expect only returns non-blank permitted scalars (excludes Hash, Array, nil, "", etc)
```
*Martin Emde*
* System Testing: Disable Chrome's search engine choice by default in system tests.
*glaszig*
* Fix `Request#raw_post` raising `NoMethodError` when `rack.input` is `nil`.
*Hartley McGuire*
* Remove `racc` dependency by manually writing `ActionDispatch::Journey::Scanner`.
*Gannon McGibbon*
* Speed up `ActionDispatch::Routing::Mapper::Scope#[]` by merging frame hashes.
*Gannon McGibbon*
* Allow bots to ignore `allow_browser`.
*Matthew Nguyen*
* Deprecate drawing routes with multiple paths to make routing faster.
You may use `with_options` or a loop to make drawing multiple paths easier.
```ruby
# Before
get "/users", "/other_path", to: "users#index"
# After
get "/users", to: "users#index"
get "/other_path", to: "users#index"
```
*Gannon McGibbon*
* Make `http_cache_forever` use `immutable: true`
*Nate Matykiewicz*
* Add `config.action_dispatch.strict_freshness`.
When set to `true`, the `ETag` header takes precedence over the `Last-Modified` header when both are present,
as specified by RFC 7232, Section 6.
Defaults to `false` to maintain compatibility with previous versions of Rails, but is enabled as part of
Rails 8.0 defaults.
*heka1024*
* Support `immutable` directive in Cache-Control
```ruby
expires_in 1.minute, public: true, immutable: true
# Cache-Control: public, max-age=60, immutable
```
*heka1024*
* Add `:wasm_unsafe_eval` mapping for `content_security_policy`
```ruby
# Before
policy.script_src "'wasm-unsafe-eval'"
# After
policy.script_src :wasm_unsafe_eval
```
*Joe Haig*
* Add `display_capture` and `keyboard_map` in `permissions_policy`
*Cyril Blaecke*
* Add `connect` route helper.
*Samuel Williams*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionpack/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actionpack/CHANGELOG.md) for previous changes.

View File

@ -10,9 +10,9 @@ module ActionPack
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,49 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* No changes.
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Dispatch direct-upload events on attachment uploads
When using Action Text's rich textarea, it's possible to attach files to the
editor. Previously, that action didn't dispatch any events, which made it hard
to react to the file uploads. For instance, if an upload failed, there was no
way to notify the user about it, or remove the attachment from the editor.
This commits adds new events - `direct-upload:start`, `direct-upload:progress`,
and `direct-upload:end` - similar to how Active Storage's direct uploads work.
*Matheus Richard*, *Brad Rees*
* Add `store_if_blank` option to `has_rich_text`
Pass `store_if_blank: false` to not create `ActionText::RichText` records when saving with a blank attribute, such as from an optional form parameter.
```ruby
class Message
has_rich_text :content, store_if_blank: false
end
Message.create(content: "hi") # creates an ActionText::RichText
Message.create(content: "") # does not create an ActionText::RichText
```
*Alex Ghiculescu*
* Strip `content` attribute if the key is present but the value is empty
*Jeremy Green*
* Rename `rich_text_area` methods into `rich_textarea`
Old names are still available as aliases.
*Sean Doyle*
* Only sanitize `content` attribute when present in attachments.
*Petrik de Heus*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actiontext/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actiontext/CHANGELOG.md) for previous changes.

View File

@ -10,9 +10,9 @@ module ActionText
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,6 +1,6 @@
{
"name": "@rails/actiontext",
"version": "8.0.0-rc1",
"version": "8.1.0-alpha",
"description": "Edit and display rich text in Rails applications",
"module": "app/assets/javascripts/actiontext.esm.js",
"main": "app/assets/javascripts/actiontext.js",
@ -22,7 +22,7 @@
],
"license": "MIT",
"dependencies": {
"@rails/activestorage": ">= 8.0.0-alpha"
"@rails/activestorage": ">= 8.1.0-alpha"
},
"peerDependencies": {
"trix": "^2.0.0"

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2019_03_17_200724) do
ActiveRecord::Schema[8.1].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"

View File

@ -1,38 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* Remove deprecated support to passing a content to void tag elements on the `tag` builder.
*Rafael Mendonça França*
* Remove deprecated support to passing `nil` to the `model:` argument of `form_with`.
*Rafael Mendonça França*
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Enable DependencyTracker to evaluate renders with trailing interpolation.
```erb
<%= render "maintenance_tasks/runs/info/#{run.status}" %>
```
Previously, the DependencyTracker would ignore this render, but now it will
mark all partials in the "maintenance_tasks/runs/info" folder as
dependencies.
*Hartley McGuire*
* Rename `text_area` methods into `textarea`
Old names are still available as aliases.
*Sean Doyle*
* Rename `check_box*` methods into `checkbox*`.
Old names are still available as aliases.
*Jean Boussier*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionview/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actionview/CHANGELOG.md) for previous changes.

View File

@ -8,9 +8,9 @@ module ActionView
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,20 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* Remove deprecated `config.active_job.use_big_decimal_serializer`.
*Rafael Mendonça França*
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Deprecate `sucker_punch` as an adapter option.
If you're using this adapter, change to `adapter: async` for the same functionality.
*Dino Maric, zzak*
* Use `RAILS_MAX_THREADS` in `ActiveJob::AsyncAdapter`. If it is not set, use 5 as default.
*heka1024*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activejob/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activejob/CHANGELOG.md) for previous changes.

View File

@ -8,9 +8,9 @@ module ActiveJob
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,90 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* Add `:except_on` option for validations. Grants the ability to _skip_ validations in specified contexts.
```ruby
class User < ApplicationRecord
#...
validates :birthday, presence: { except_on: :admin }
#...
end
user = User.new(attributes except birthday)
user.save(context: :admin)
```
*Drew Bragg*
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Make `ActiveModel::Serialization#read_attribute_for_serialization` public
*Sean Doyle*
* Add a default token generator for password reset tokens when using `has_secure_password`.
```ruby
class User < ApplicationRecord
has_secure_password
end
user = User.create!(name: "david", password: "123", password_confirmation: "123")
token = user.password_reset_token
User.find_by_password_reset_token(token) # returns user
# 16 minutes later...
User.find_by_password_reset_token(token) # returns nil
# raises ActiveSupport::MessageVerifier::InvalidSignature since the token is expired
User.find_by_password_reset_token!(token)
```
*DHH*
* Add a load hook `active_model_translation` for `ActiveModel::Translation`.
*Shouichi Kamiya*
* Add `raise_on_missing_translations` option to `ActiveModel::Translation`.
When the option is set, `human_attribute_name` raises an error if a translation of the given attribute is missing.
```ruby
# ActiveModel::Translation.raise_on_missing_translations = false
Post.human_attribute_name("title")
=> "Title"
# ActiveModel::Translation.raise_on_missing_translations = true
Post.human_attribute_name("title")
=> Translation missing. Options considered were: (I18n::MissingTranslationData)
- en.activerecord.attributes.post.title
- en.attributes.title
raise exception.respond_to?(:to_exception) ? exception.to_exception : exception
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
*Shouichi Kamiya*
* Introduce `ActiveModel::AttributeAssignment#attribute_writer_missing`
Provide instances with an opportunity to gracefully handle assigning to an
unknown attribute:
```ruby
class Rectangle
include ActiveModel::AttributeAssignment
attr_accessor :length, :width
def attribute_writer_missing(name, value)
Rails.logger.warn "Tried to assign to unknown attribute #{name}"
end
end
rectangle = Rectangle.new
rectangle.assign_attributes(height: 10) # => Logs "Tried to assign to unknown attribute 'height'"
```
*Sean Doyle*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activemodel/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activemodel/CHANGELOG.md) for previous changes.

View File

@ -8,9 +8,9 @@ module ActiveModel
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,413 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* Remove deprecated support to setting `ENV["SCHEMA_CACHE"]`.
*Rafael Mendonça França*
* Remove deprecated support to passing a database name to `cache_dump_filename`.
*Rafael Mendonça França*
* Remove deprecated `ActiveRecord::ConnectionAdapters::ConnectionPool#connection`.
*Rafael Mendonça França*
* Remove deprecated `config.active_record.sqlite3_deprecated_warning`.
*Rafael Mendonça França*
* Remove deprecated `config.active_record.warn_on_records_fetched_greater_than`.
*Rafael Mendonça França*
* Remove deprecated support for defining `enum` with keyword arguments.
*Rafael Mendonça França*
* Remove deprecated support to finding database adapters that aren't registered to Active Record.
*Rafael Mendonça França*
* Remove deprecated `config.active_record.allow_deprecated_singular_associations_name`.
*Rafael Mendonça França*
* Remove deprecated `config.active_record.commit_transaction_on_non_local_return`.
*Rafael Mendonça França*
* Fix incorrect SQL query when passing an empty hash to `ActiveRecord::Base.insert`.
*David Stosik*
* Allow to save records with polymorphic join tables that have `inverse_of`
specified.
*Markus Doits*
* Fix association scopes applying on the incorrect join when using a polymorphic `has_many through:`.
*Joshua Young*
* Allow `ActiveRecord::Base#pluck` to accept hash arguments with symbol and string values.
```ruby
Post.joins(:comments).pluck(:id, comments: :id)
Post.joins(:comments).pluck("id", "comments" => "id")
```
*Joshua Young*
* Make Float distinguish between `float4` and `float8` in PostgreSQL.
Fixes #52742
*Ryota Kitazawa*, *Takayuki Nagatomi*
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Allow `drop_table` to accept an array of table names.
This will let you to drop multiple tables in a single call.
```ruby
ActiveRecord::Base.lease_connection.drop_table(:users, :posts)
```
*Gabriel Sobrinho*
* Add support for PostgreSQL `IF NOT EXISTS` via the `:if_not_exists` option
on the `add_enum_value` method.
*Ariel Rzezak*
* When running `db:migrate` on a fresh database, load the database schema before running migrations.
*Andrew Novoselac*
* Fix an issue where `.left_outer_joins` used with multiple associations that have
the same child association but different parents does not join all parents.
Previously, using `.left_outer_joins` with the same child association would only join one of the parents.
Now it will correctly join both parents.
Fixes #41498.
*Garrett Blehm*
* Deprecate `unsigned_float` and `unsigned_decimal` short-hand column methods.
As of MySQL 8.0.17, the UNSIGNED attribute is deprecated for columns of type FLOAT, DOUBLE,
and DECIMAL. Consider using a simple CHECK constraint instead for such columns.
https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html
*Ryuta Kamizono*
* Drop MySQL 5.5 support.
MySQL 5.5 is the only version that does not support datetime with precision,
which we have supported in the core. Now we support MySQL 5.6.4 or later, which
is the first version to support datetime with precision.
*Ryuta Kamizono*
* Make Active Record asynchronous queries compatible with transactional fixtures.
Previously transactional fixtures would disable asynchronous queries, because transactional
fixtures impose all queries use the same connection.
Now asynchronous queries will use the connection pinned by transactional fixtures, and behave
much closer to production.
*Jean Boussier*
* Deserialize binary data before decrypting
This ensures that we call `PG::Connection.unescape_bytea` on PostgreSQL before decryption.
*Donal McBreen*
* Ensure `ActiveRecord::Encryption.config` is always ready before access.
Previously, `ActiveRecord::Encryption` configuration was deferred until `ActiveRecord::Base`
was loaded. Therefore, accessing `ActiveRecord::Encryption.config` properties before
`ActiveRecord::Base` was loaded would give incorrect results.
`ActiveRecord::Encryption` now has its own loading hook so that its configuration is set as
soon as needed.
When `ActiveRecord::Base` is loaded, even lazily, it in turn triggers the loading of
`ActiveRecord::Encryption`, thus preserving the original behavior of having its config ready
before any use of `ActiveRecord::Base`.
*Maxime Réty*
* Add `TimeZoneConverter#==` method, so objects will be properly compared by
their type, scale, limit & precision.
Address #52699.
*Ruy Rocha*
* Add support for SQLite3 full-text-search and other virtual tables.
Previously, adding sqlite3 virtual tables messed up `schema.rb`.
Now, virtual tables can safely be added using `create_virtual_table`.
*Zacharias Knudsen*
* Support use of alternative database interfaces via the `database_cli` ActiveRecord configuration option.
```ruby
Rails.application.configure do
config.active_record.database_cli = { postgresql: "pgcli" }
end
```
*T S Vallender*
* Add support for dumping table inheritance and native partitioning table definitions for PostgeSQL adapter
*Justin Talbott*
* Add support for `ActiveRecord::Point` type casts using `Hash` values
This allows `ActiveRecord::Point` to be cast or serialized from a hash
with `:x` and `:y` keys of numeric values, mirroring the functionality of
existing casts for string and array values. Both string and symbol keys are
supported.
```ruby
class PostgresqlPoint < ActiveRecord::Base
attribute :x, :point
attribute :y, :point
attribute :z, :point
end
val = PostgresqlPoint.new({
x: '(12.34, -43.21)',
y: [12.34, '-43.21'],
z: {x: '12.34', y: -43.21}
})
ActiveRecord::Point.new(12.32, -43.21) == val.x == val.y == val.z
```
*Stephen Drew*
* Replace `SQLite3::Database#busy_timeout` with `#busy_handler_timeout=`.
Provides a non-GVL-blocking, fair retry interval busy handler implementation.
*Stephen Margheim*
* SQLite3Adapter: Translate `SQLite3::BusyException` into `ActiveRecord::StatementTimeout`.
*Matthew Nguyen*
* Include schema name in `enable_extension` statements in `db/schema.rb`.
The schema dumper will now include the schema name in generated
`enable_extension` statements if they differ from the current schema.
For example, if you have a migration:
```ruby
enable_extension "heroku_ext.pgcrypto"
enable_extension "pg_stat_statements"
```
then the generated schema dump will also contain:
```ruby
enable_extension "heroku_ext.pgcrypto"
enable_extension "pg_stat_statements"
```
*Tony Novak*
* Fix `ActiveRecord::Encryption::EncryptedAttributeType#type` to return
actual cast type.
*Vasiliy Ermolovich*
* SQLite3Adapter: Bulk insert fixtures.
Previously one insert command was executed for each fixture, now they are
aggregated in a single bulk insert command.
*Lázaro Nixon*
* PostgreSQLAdapter: Allow `disable_extension` to be called with schema-qualified name.
For parity with `enable_extension`, the `disable_extension` method can be called with a schema-qualified
name (e.g. `disable_extension "myschema.pgcrypto"`). Note that PostgreSQL's `DROP EXTENSION` does not
actually take a schema name (unlike `CREATE EXTENSION`), so the resulting SQL statement will only name
the extension, e.g. `DROP EXTENSION IF EXISTS "pgcrypto"`.
*Tony Novak*
* Make `create_schema` / `drop_schema` reversible in migrations.
Previously, `create_schema` and `drop_schema` were irreversible migration operations.
*Tony Novak*
* Support batching using custom columns.
```ruby
Product.in_batches(cursor: [:shop_id, :id]) do |relation|
# do something with relation
end
```
*fatkodima*
* Use SQLite `IMMEDIATE` transactions when possible.
Transactions run against the SQLite3 adapter default to IMMEDIATE mode to improve concurrency support and avoid busy exceptions.
*Stephen Margheim*
* Raise specific exception when a connection is not defined.
The new `ConnectionNotDefined` exception provides connection name, shard and role accessors indicating the details of the connection that was requested.
*Hana Harencarova*, *Matthew Draper*
* Delete the deprecated constant `ActiveRecord::ImmutableRelation`.
*Xavier Noria*
* Fix duplicate callback execution when child autosaves parent with `has_one` and `belongs_to`.
Before, persisting a new child record with a new associated parent record would run `before_validation`,
`after_validation`, `before_save` and `after_save` callbacks twice.
Now, these callbacks are only executed once as expected.
*Joshua Young*
* `ActiveRecord::Encryption::Encryptor` now supports a `:compressor` option to customize the compression algorithm used.
```ruby
module ZstdCompressor
def self.deflate(data)
Zstd.compress(data)
end
def self.inflate(data)
Zstd.decompress(data)
end
end
class User
encrypts :name, compressor: ZstdCompressor
end
```
You disable compression by passing `compress: false`.
```ruby
class User
encrypts :name, compress: false
end
```
*heka1024*
* Add condensed `#inspect` for `ConnectionPool`, `AbstractAdapter`, and
`DatabaseConfig`.
*Hartley McGuire*
* Add `.shard_keys`, `.sharded?`, & `.connected_to_all_shards` methods.
```ruby
class ShardedBase < ActiveRecord::Base
self.abstract_class = true
connects_to shards: {
shard_one: { writing: :shard_one },
shard_two: { writing: :shard_two }
}
end
class ShardedModel < ShardedBase
end
ShardedModel.shard_keys => [:shard_one, :shard_two]
ShardedModel.sharded? => true
ShardedBase.connected_to_all_shards { ShardedModel.current_shard } => [:shard_one, :shard_two]
```
*Nony Dutton*
* Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
by these values.
*Igor Depolli*
* Fix an issue where the IDs reader method did not return expected results
for preloaded associations in models using composite primary keys.
*Jay Ang*
* Allow to configure `strict_loading_mode` globally or within a model.
Defaults to `:all`, can be changed to `:n_plus_one_only`.
*Garen Torikian*
* Add `ActiveRecord::Relation#readonly?`.
Reflects if the relation has been marked as readonly.
*Theodor Tonum*
* Improve `ActiveRecord::Store` to raise a descriptive exception if the column is not either
structured (e.g., PostgreSQL +hstore+/+json+, or MySQL +json+) or declared serializable via
`ActiveRecord.store`.
Previously, a `NoMethodError` would be raised when the accessor was read or written:
NoMethodError: undefined method `accessor' for an instance of ActiveRecord::Type::Text
Now, a descriptive `ConfigurationError` is raised:
ActiveRecord::ConfigurationError: the column 'metadata' has not been configured as a store.
Please make sure the column is declared serializable via 'ActiveRecord.store' or, if your
database supports it, use a structured column type like hstore or json.
*Mike Dalessio*
* Fix inference of association model on nested models with the same demodularized name.
E.g. with the following setup:
```ruby
class Nested::Post < ApplicationRecord
has_one :post, through: :other
end
```
Before, `#post` would infer the model as `Nested::Post`, but now it correctly infers `Post`.
*Joshua Young*
* Add public method for checking if a table is ignored by the schema cache.
Previously, an application would need to reimplement `ignored_table?` from the schema cache class to check if a table was set to be ignored. This adds a public method to support this and updates the schema cache to use that directly.
```ruby
ActiveRecord.schema_cache_ignored_tables = ["developers"]
ActiveRecord.schema_cache_ignored_table?("developers")
=> true
```
*Eileen M. Uchitelle*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activerecord/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activerecord/CHANGELOG.md) for previous changes.

View File

@ -139,7 +139,7 @@ A short rundown of some of the major features:
* Database agnostic schema management with Migrations.
class AddSystemSettings < ActiveRecord::Migration[8.0]
class AddSystemSettings < ActiveRecord::Migration[8.1]
def up
create_table :system_settings do |t|
t.string :name

View File

@ -1696,7 +1696,7 @@ module ActiveRecord
# The join table should not have a primary key or a model associated with it. You must manually generate the
# join table with a migration such as this:
#
# class CreateDevelopersProjectsJoinTable < ActiveRecord::Migration[8.0]
# class CreateDevelopersProjectsJoinTable < ActiveRecord::Migration[8.1]
# def change
# create_join_table :developers, :projects
# end

View File

@ -347,7 +347,7 @@ module ActiveRecord
# Inside migration files, the +t+ object in {create_table}[rdoc-ref:SchemaStatements#create_table]
# is actually of this type:
#
# class SomeMigration < ActiveRecord::Migration[8.0]
# class SomeMigration < ActiveRecord::Migration[8.1]
# def up
# create_table :foo do |t|
# puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"

View File

@ -8,9 +8,9 @@ module ActiveRecord
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -18,7 +18,7 @@ module ActiveRecord
# For example the following migration is not reversible.
# Rolling back this migration will raise an ActiveRecord::IrreversibleMigration error.
#
# class IrreversibleMigrationExample < ActiveRecord::Migration[8.0]
# class IrreversibleMigrationExample < ActiveRecord::Migration[8.1]
# def change
# create_table :distributors do |t|
# t.string :zipcode
@ -36,7 +36,7 @@ module ActiveRecord
#
# 1. Define <tt>#up</tt> and <tt>#down</tt> methods instead of <tt>#change</tt>:
#
# class ReversibleMigrationExample < ActiveRecord::Migration[8.0]
# class ReversibleMigrationExample < ActiveRecord::Migration[8.1]
# def up
# create_table :distributors do |t|
# t.string :zipcode
@ -61,7 +61,7 @@ module ActiveRecord
#
# 2. Use the #reversible method in <tt>#change</tt> method:
#
# class ReversibleMigrationExample < ActiveRecord::Migration[8.0]
# class ReversibleMigrationExample < ActiveRecord::Migration[8.1]
# def change
# create_table :distributors do |t|
# t.string :zipcode
@ -247,7 +247,7 @@ module ActiveRecord
#
# Example of a simple migration:
#
# class AddSsl < ActiveRecord::Migration[8.0]
# class AddSsl < ActiveRecord::Migration[8.1]
# def up
# add_column :accounts, :ssl_enabled, :boolean, default: true
# end
@ -267,7 +267,7 @@ module ActiveRecord
#
# Example of a more complex migration that also needs to initialize data:
#
# class AddSystemSettings < ActiveRecord::Migration[8.0]
# class AddSystemSettings < ActiveRecord::Migration[8.1]
# def up
# create_table :system_settings do |t|
# t.string :name
@ -396,7 +396,7 @@ module ActiveRecord
# $ bin/rails generate migration add_fieldname_to_tablename fieldname:string
#
# This will generate the file <tt>timestamp_add_fieldname_to_tablename.rb</tt>, which will look like this:
# class AddFieldnameToTablename < ActiveRecord::Migration[8.0]
# class AddFieldnameToTablename < ActiveRecord::Migration[8.1]
# def change
# add_column :tablenames, :fieldname, :string
# end
@ -422,7 +422,7 @@ module ActiveRecord
#
# Not all migrations change the schema. Some just fix the data:
#
# class RemoveEmptyTags < ActiveRecord::Migration[8.0]
# class RemoveEmptyTags < ActiveRecord::Migration[8.1]
# def up
# Tag.all.each { |tag| tag.destroy if tag.pages.empty? }
# end
@ -435,7 +435,7 @@ module ActiveRecord
#
# Others remove columns when they migrate up instead of down:
#
# class RemoveUnnecessaryItemAttributes < ActiveRecord::Migration[8.0]
# class RemoveUnnecessaryItemAttributes < ActiveRecord::Migration[8.1]
# def up
# remove_column :items, :incomplete_items_count
# remove_column :items, :completed_items_count
@ -449,7 +449,7 @@ module ActiveRecord
#
# And sometimes you need to do something in SQL not abstracted directly by migrations:
#
# class MakeJoinUnique < ActiveRecord::Migration[8.0]
# class MakeJoinUnique < ActiveRecord::Migration[8.1]
# def up
# execute "ALTER TABLE `pages_linked_pages` ADD UNIQUE `page_id_linked_page_id` (`page_id`,`linked_page_id`)"
# end
@ -466,7 +466,7 @@ module ActiveRecord
# <tt>Base#reset_column_information</tt> in order to ensure that the model has the
# latest column data from after the new column was added. Example:
#
# class AddPeopleSalary < ActiveRecord::Migration[8.0]
# class AddPeopleSalary < ActiveRecord::Migration[8.1]
# def up
# add_column :people, :salary, :integer
# Person.reset_column_information
@ -528,7 +528,7 @@ module ActiveRecord
# To define a reversible migration, define the +change+ method in your
# migration like this:
#
# class TenderloveMigration < ActiveRecord::Migration[8.0]
# class TenderloveMigration < ActiveRecord::Migration[8.1]
# def change
# create_table(:horses) do |t|
# t.column :content, :text
@ -558,7 +558,7 @@ module ActiveRecord
# can't execute inside a transaction though, and for these situations
# you can turn the automatic transactions off.
#
# class ChangeEnum < ActiveRecord::Migration[8.0]
# class ChangeEnum < ActiveRecord::Migration[8.1]
# disable_ddl_transaction!
#
# def up
@ -819,7 +819,7 @@ module ActiveRecord
# and create the table 'apples' on the way up, and the reverse
# on the way down.
#
# class FixTLMigration < ActiveRecord::Migration[8.0]
# class FixTLMigration < ActiveRecord::Migration[8.1]
# def change
# revert do
# create_table(:horses) do |t|
@ -838,7 +838,7 @@ module ActiveRecord
#
# require_relative "20121212123456_tenderlove_migration"
#
# class FixupTLMigration < ActiveRecord::Migration[8.0]
# class FixupTLMigration < ActiveRecord::Migration[8.1]
# def change
# revert TenderloveMigration
#
@ -889,7 +889,7 @@ module ActiveRecord
# when the three columns 'first_name', 'last_name' and 'full_name' exist,
# even when migrating down:
#
# class SplitNameMigration < ActiveRecord::Migration[8.0]
# class SplitNameMigration < ActiveRecord::Migration[8.1]
# def change
# add_column :users, :first_name, :string
# add_column :users, :last_name, :string
@ -917,7 +917,7 @@ module ActiveRecord
# In the following example, the new column +published+ will be given
# the value +true+ for all existing records.
#
# class AddPublishedToPosts < ActiveRecord::Migration[8.0]
# class AddPublishedToPosts < ActiveRecord::Migration[8.1]
# def change
# add_column :posts, :published, :boolean, default: false
# up_only do

View File

@ -21,7 +21,7 @@ module ActiveRecord
# New migration functionality that will never be backward compatible should be added directly to `ActiveRecord::Migration`.
#
# There are classes for each prior Rails version. Each class descends from the *next* Rails version, so:
# 5.2 < 6.0 < 6.1 < 7.0 < 7.1 < 7.2 < 8.0
# 5.2 < 6.0 < 6.1 < 7.0 < 7.1 < 7.2 < 8.0 < 8.1
#
# If you are introducing new migration functionality that should only apply from Rails 7 onward, then you should
# find the class that immediately precedes it (6.1), and override the relevant migration methods to undo your changes.
@ -29,7 +29,10 @@ module ActiveRecord
# For example, Rails 6 added a default value for the `precision` option on datetime columns. So in this file, the `V5_2`
# class sets the value of `precision` to `nil` if it's not explicitly provided. This way, the default value will not apply
# for migrations written for 5.2, but will for migrations written for 6.0.
V8_0 = Current
V8_1 = Current
class V8_0 < V8_1
end
class V7_2 < V8_0
end

View File

@ -501,7 +501,7 @@ module ActiveRecord
# when just after creating a table you want to populate it with some default
# values, e.g.:
#
# class CreateJobLevels < ActiveRecord::Migration[8.0]
# class CreateJobLevels < ActiveRecord::Migration[8.1]
# def up
# create_table :job_levels do |t|
# t.integer :id

View File

@ -1,28 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* No changes.
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Deprecate `ActiveStorage::Service::AzureStorageService`.
*zzak*
* Improve `ActiveStorage::Filename#sanitized` method to handle special characters more effectively.
Replace the characters `"*?<>` with `-` if they exist in the Filename to match the Filename convention of Win OS.
*Luong Viet Dung(Martin)*
* Improve InvariableError, UnpreviewableError and UnrepresentableError message.
Include Blob ID and content_type in the messages.
*Petrik de Heus*
* Mark proxied files as `immutable` in their Cache-Control header
*Nate Matykiewicz*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activestorage/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activestorage/CHANGELOG.md) for previous changes.

View File

@ -8,9 +8,9 @@ module ActiveStorage
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,6 +1,6 @@
{
"name": "@rails/activestorage",
"version": "8.0.0-rc1",
"version": "8.1.0-alpha",
"description": "Attach cloud and local files in Rails applications",
"module": "app/assets/javascripts/activestorage.esm.js",
"main": "app/assets/javascripts/activestorage.js",

View File

@ -1,126 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* Remove deprecated support to passing an array of strings to `ActiveSupport::Deprecation#warn`.
*Rafael Mendonça França*
* Remove deprecated support to setting `attr_internal_naming_format` with a `@` prefix.
*Rafael Mendonça França*
* Remove deprecated `ActiveSupport::ProxyObject`.
*Rafael Mendonça França*
* Don't execute i18n watcher on boot. It shouldn't catch any file changes initially,
and unnecessarily slows down boot of applications with lots of translations.
*Gannon McGibbon*, *David Stosik*
* Fix `ActiveSupport::HashWithIndifferentAccess#stringify_keys` to stringify all keys not just symbols.
Previously:
```ruby
{ 1 => 2 }.with_indifferent_access.stringify_keys[1] # => 2
```
After this change:
```ruby
{ 1 => 2 }.with_indifferent_access.stringify_keys["1"] # => 2
```
This change can be seen as a bug fix, but since it behaved like this for a very long time, we're deciding
to not backport the fix and to make the change in a major release.
*Jean Boussier*
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
*Adam Renberg Tamm*
* Print test names when running `rails test -v` for parallel tests.
*John Hawthorn*, *Abeid Ahmed*
* Deprecate `Benchmark.ms` core extension.
The `benchmark` gem will become bundled in Ruby 3.5
*Earlopain*
* `ActiveSupport::TimeWithZone#inspect` now uses ISO 8601 style time like `Time#inspect`
*John Hawthorn*
* `ActiveSupport::ErrorReporter#report` now assigns a backtrace to unraised exceptions.
Previously reporting an un-raised exception would result in an error report without
a backtrace. Now it automatically generates one.
*Jean Boussier*
* Add `escape_html_entities` option to `ActiveSupport::JSON.encode`.
This allows for overriding the global configuration found at
`ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`.
This should be usable from controllers in the following manner:
```ruby
class MyController < ApplicationController
def index
render json: { hello: "world" }, escape_html_entities: false
end
end
```
*Nigel Baillie*
* Raise when using key which can't respond to `#to_sym` in `EncryptedConfiguration`.
As is the case when trying to use an Integer or Float as a key, which is unsupported.
*zzak*
* Deprecate addition and since between two `Time` and `ActiveSupport::TimeWithZone`.
Previously adding time instances together such as `10.days.ago + 10.days.ago` or `10.days.ago.since(10.days.ago)` produced a nonsensical future date. This behavior is deprecated and will be removed in Rails 8.1.
*Nick Schwaderer*
* Support rfc2822 format for Time#to_fs & Date#to_fs.
*Akshay Birajdar*
* Optimize load time for `Railtie#initialize_i18n`. Filter `I18n.load_path`s passed to the file watcher to only those
under `Rails.root`. Previously the watcher would grab all available locales, including those in gems
which do not require a watcher because they won't change.
*Nick Schwaderer*
* Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
by these values.
*Igor Depolli*
* Improve error message when using `assert_difference` or `assert_changes` with a
proc by printing the proc's source code (MRI only).
*Richard Böhme*, *Jean Boussier*
* Add a new configuration value `:zone` for `ActiveSupport.to_time_preserves_timezone` and rename the previous `true` value to `:offset`. The new default value is `:zone`.
*Jason Kim*, *John Hawthorn*
* Align instrumentation `payload[:key]` in ActiveSupport::Cache to follow the same pattern, with namespaced and normalized keys.
*Frederik Erbs Spang Thomsen*
* Fix `travel_to` to set usec 0 when `with_usec` is `false` and the given argument String or DateTime.
*mopp*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activesupport/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activesupport/CHANGELOG.md) for previous changes.

View File

@ -68,7 +68,7 @@ module ActiveSupport
# and the second is a library name.
#
# ActiveSupport::Deprecation.new('2.0', 'MyLibrary')
def initialize(deprecation_horizon = "8.1", gem_name = "Rails")
def initialize(deprecation_horizon = "8.2", gem_name = "Rails")
self.gem_name = gem_name
self.deprecation_horizon = deprecation_horizon
# By default, warnings are not silenced and debugging is off.

View File

@ -8,9 +8,9 @@ module ActiveSupport
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,17 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* No changes.
## Rails 8.0.0.beta1 (September 26, 2024) ##
* The guide _Classic to Zeitwerk HOWTO_ that documented how to migrate from
the `classic` autoloader to Zeitwerk has been deleted.
The last version of this guide can be found
[here](https://guides.rubyonrails.org/v7.2/classic_to_zeitwerk_howto.html),
in case you need it.
*Petrik de Heus*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/guides/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/guides/CHANGELOG.md) for previous changes.

View File

@ -0,0 +1,331 @@
**DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.**
Ruby on Rails 8.1 Release Notes
===============================
Highlights in Rails 8.1:
--------------------------------------------------------------------------------
Upgrading to Rails 8.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 8.0 in case you
haven't and make sure your application still runs as expected before attempting
an update to Rails 8.1. A list of things to watch out for when upgrading is
available in the
[Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#upgrading-from-rails-8-0-to-rails-8-1)
guide.
Major Features
--------------
Railties
--------
Please refer to the [Changelog][railties] for detailed changes.
### Removals
* Remove deprecated `Rails::Generators::Testing::Behaviour`.
* Remove deprecated `Rails.application.secrets`.
* Remove deprecated `Rails.config.enable_dependency_loading`.
* Remove deprecated `find_cmd_and_exec` console helper.
### Deprecations
### Notable changes
Action Cable
------------
Please refer to the [Changelog][action-cable] for detailed changes.
### Removals
### Deprecations
### Notable changes
Action Pack
-----------
Please refer to the [Changelog][action-pack] for detailed changes.
### Removals
* Remove deprecated constant `ActionDispatch::IllegalStateError`.
* Remove deprecated constant `AbstractController::Helpers::MissingHelperError`.
* Remove deprecated comparison between `ActionController::Parameters` and `Hash`.
* Remove deprecated `Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type`.
* Remove deprecated `speaker`, `vibrate`, and `vr` permissions policy directives.
* Remove deprecated support to set `Rails.application.config.action_dispatch.show_exceptions` to `true` and `false`.
### Deprecations
* Deprecate `Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`.
### Notable changes
Action View
-----------
Please refer to the [Changelog][action-view] for detailed changes.
### Removals
* Remove deprecated `@rails/ujs` in favor of `Turbo`.
### Deprecations
* Deprecate passing content to void elements when using `tag.br` type tag builders.
### Notable changes
Action Mailer
-------------
Please refer to the [Changelog][action-mailer] for detailed changes.
### Removals
* Remove deprecated `config.action_mailer.preview_path`.
* Remove deprecated params via `:args` for `assert_enqueued_email_with`.
### Deprecations
### Notable changes
Active Record
-------------
Please refer to the [Changelog][active-record] for detailed changes.
### Removals
* Remove deprecated `Rails.application.config.active_record.suppress_multiple_database_warning`.
* Remove deprecated support to call `alias_attribute` with non-existent attribute names.
* Remove deprecated `name` argument from `ActiveRecord::Base.remove_connection`.
* Remove deprecated `ActiveRecord::Base.clear_active_connections!`.
* Remove deprecated `ActiveRecord::Base.clear_reloadable_connections!`.
* Remove deprecated `ActiveRecord::Base.clear_all_connections!`.
* Remove deprecated `ActiveRecord::Base.flush_idle_connections!`.
* Remove deprecated `ActiveRecord::ActiveJobRequiredError`.
* Remove deprecated support to define `explain` in the connection adapter with 2 arguments.
* Remove deprecated `ActiveRecord::LogSubscriber.runtime` method.
* Remove deprecated `ActiveRecord::LogSubscriber.runtime=` method.
* Remove deprecated `ActiveRecord::LogSubscriber.reset_runtime` method.
* Remove deprecated `ActiveRecord::Migration.check_pending` method.
* Remove deprecated support to passing `SchemaMigration` and `InternalMetadata` classes as arguments to
`ActiveRecord::MigrationContext`.
* Remove deprecated behavior to support referring to a singular association by its plural name.
* Remove deprecated `TestFixtures.fixture_path`.
* Remove deprecated support to `ActiveRecord::Base#read_attribute(:id)` to return the custom primary key value.
* Remove deprecated support to passing coder and class as second argument to `serialize`.
* Remove deprecated `#all_foreign_keys_valid?` from database adapters.
* Remove deprecated `ActiveRecord::ConnectionAdapters::SchemaCache.load_from`.
* Remove deprecated `ActiveRecord::ConnectionAdapters::SchemaCache#data_sources`.
* Remove deprecated `#all_connection_pools`.
* Remove deprecated support to apply `#connection_pool_list`, `#active_connections?`, `#clear_active_connections!`,
`#clear_reloadable_connections!`, `#clear_all_connections!` and `#flush_idle_connections!` to the connections pools
for the current role when the `role` argument isn't provided.
* Remove deprecated `ActiveRecord::ConnectionAdapters::ConnectionPool#connection_klass`.
* Remove deprecated `#quote_bound_value`.
* Remove deprecated support to quote `ActiveSupport::Duration`.
* Remove deprecated support to pass `deferrable: true` to `add_foreign_key`.
* Remove deprecated support to pass `rewhere` to `ActiveRecord::Relation#merge`.
* Remove deprecated behavior that would rollback a transaction block when exited using `return`, `break` or `throw`.
### Deprecations
* Deprecate `Rails.application.config.active_record.allow_deprecated_singular_associations_name`
* Deprecate `Rails.application.config.active_record.commit_transaction_on_non_local_return`
### Notable changes
Active Storage
--------------
Please refer to the [Changelog][active-storage] for detailed changes.
### Removals
* Remove deprecated `config.active_storage.replace_on_assign_to_many`.
* Remove deprecated `config.active_storage.silence_invalid_content_types_warning`.
### Deprecations
### Notable changes
Active Model
------------
Please refer to the [Changelog][active-model] for detailed changes.
### Removals
### Deprecations
### Notable changes
Active Support
--------------
Please refer to the [Changelog][active-support] for detailed changes.
### Removals
* Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`.
* Remove deprecated support to call the following methods without passing a deprecator:
- `deprecate`
- `deprecate_constant`
- `ActiveSupport::Deprecation::DeprecatedObjectProxy.new`
- `ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new`
- `ActiveSupport::Deprecation::DeprecatedConstantProxy.new`
- `assert_deprecated`
- `assert_not_deprecated`
- `collect_deprecations`
* Remove deprecated `ActiveSupport::Deprecation` delegation to instance.
* Remove deprecated `SafeBuffer#clone_empty`.
* Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.
* Remove deprecated `:pool_size` and `:pool_timeout` options for the cache storage.
* Remove deprecated support for `config.active_support.cache_format_version = 6.1`.
* Remove deprecated constants `ActiveSupport::LogSubscriber::CLEAR` and `ActiveSupport::LogSubscriber::BOLD`.
* Remove deprecated support to bolding log text with positional boolean in `ActiveSupport::LogSubscriber#color`.
* Remove deprecated `config.active_support.disable_to_s_conversion`.
* Remove deprecated `config.active_support.remove_deprecated_time_with_zone_name`.
* Remove deprecated `config.active_support.use_rfc4122_namespaced_uuids`.
* Remove deprecated support to passing `Dalli::Client` instances to `MemCacheStore`.
* Remove deprecated support for the pre-Ruby 2.4 behavior of `to_time` returning a `Time` object with local timezone.
### Deprecations
* Deprecate `config.active_support.to_time_preserves_timezone`.
* Deprecate `DateAndTime::Compatibility.preserve_timezone`.
### Notable changes
Active Job
----------
Please refer to the [Changelog][active-job] for detailed changes.
### Removals
* Remove deprecated primitive serializer for `BigDecimal` arguments.
* Remove deprecated support to set numeric values to `scheduled_at` attribute.
* Remove deprecated `:exponentially_longer` value for the `:wait` in `retry_on`.
### Deprecations
* Deprecate `Rails.application.config.active_job.use_big_decimal_serialize`.
### Notable changes
Action Text
----------
Please refer to the [Changelog][action-text] for detailed changes.
### Removals
### Deprecations
### Notable changes
Action Mailbox
----------
Please refer to the [Changelog][action-mailbox] for detailed changes.
### Removals
### Deprecations
### Notable changes
Ruby on Rails Guides
--------------------
Please refer to the [Changelog][guides] for detailed changes.
### Notable changes
Credits
-------
See the
[full list of contributors to Rails](https://contributors.rubyonrails.org/)
for the many people who spent many hours making Rails, the stable and robust
framework it is. Kudos to all of them.
[railties]: https://github.com/rails/rails/blob/main/railties/CHANGELOG.md
[action-pack]: https://github.com/rails/rails/blob/main/actionpack/CHANGELOG.md
[action-view]: https://github.com/rails/rails/blob/main/actionview/CHANGELOG.md
[action-mailer]: https://github.com/rails/rails/blob/main/actionmailer/CHANGELOG.md
[action-cable]: https://github.com/rails/rails/blob/main/actioncable/CHANGELOG.md
[active-record]: https://github.com/rails/rails/blob/main/activerecord/CHANGELOG.md
[active-storage]: https://github.com/rails/rails/blob/main/activestorage/CHANGELOG.md
[active-model]: https://github.com/rails/rails/blob/main/activemodel/CHANGELOG.md
[active-support]: https://github.com/rails/rails/blob/main/activesupport/CHANGELOG.md
[active-job]: https://github.com/rails/rails/blob/main/activejob/CHANGELOG.md
[action-text]: https://github.com/rails/rails/blob/main/actiontext/CHANGELOG.md
[action-mailbox]: https://github.com/rails/rails/blob/main/actionmailbox/CHANGELOG.md
[guides]: https://github.com/rails/rails/blob/main/guides/CHANGELOG.md

View File

@ -10,7 +10,7 @@
</p>
<% else %>
<p>
These are the new guides for Rails 8.0 based on <a href="https://github.com/rails/rails/tree/<%= @version %>"><%= @version %></a>.
These are the new guides for Rails 8.1 based on <a href="https://github.com/rails/rails/tree/<%= @version %>"><%= @version %></a>.
These guides are designed to make you immediately productive with Rails, and to help you understand how all of the pieces fit together.
</p>
<% end %>

View File

@ -213,7 +213,7 @@ and results in this:
# Columns `created_at` and `updated_at` are added by `t.timestamps`.
# db/migrate/20240220143807_create_books.rb
class CreateBooks < ActiveRecord::Migration[8.0]
class CreateBooks < ActiveRecord::Migration[8.1]
def change
create_table :books do |t|
t.string :title
@ -659,7 +659,7 @@ 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[8.0]
class CreatePublications < ActiveRecord::Migration[8.1]
def change
create_table :publications do |t|
t.string :title

View File

@ -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[8.0]
class CreateProducts < ActiveRecord::Migration[8.1]
def change
create_table :products, primary_key: [:store_id, :sku] do |t|
t.integer :store_id

View File

@ -42,7 +42,7 @@ of your database. Here's an example of a migration:
```ruby
# db/migrate/20240502100843_create_products.rb
class CreateProducts < ActiveRecord::Migration[8.0]
class CreateProducts < ActiveRecord::Migration[8.1]
def change
create_table :products do |t|
t.string :name
@ -62,7 +62,7 @@ These special columns are automatically managed by Active Record if they exist.
```ruby
# db/schema.rb
ActiveRecord::Schema[8.0].define(version: 2024_05_02_100843) do
ActiveRecord::Schema[8.1].define(version: 2024_05_02_100843) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -123,7 +123,7 @@ $ bin/rails generate migration AddPartNumberToProducts
```ruby
# db/migrate/20240502101659_add_part_number_to_products.rb
class AddPartNumberToProducts < ActiveRecord::Migration[8.0]
class AddPartNumberToProducts < ActiveRecord::Migration[8.1]
def change
end
end
@ -150,7 +150,7 @@ $ bin/rails generate migration CreateProducts name:string part_number:string
generates
```ruby
class CreateProducts < ActiveRecord::Migration[8.0]
class CreateProducts < ActiveRecord::Migration[8.1]
def change
create_table :products do |t|
t.string :name
@ -180,7 +180,7 @@ $ bin/rails generate migration AddPartNumberToProducts part_number:string
This will generate the following migration:
```ruby
class AddPartNumberToProducts < ActiveRecord::Migration[8.0]
class AddPartNumberToProducts < ActiveRecord::Migration[8.1]
def change
add_column :products, :part_number, :string
end
@ -197,7 +197,7 @@ This will generate the appropriate [`add_column`][] and [`add_index`][]
statements:
```ruby
class AddPartNumberToProducts < ActiveRecord::Migration[8.0]
class AddPartNumberToProducts < ActiveRecord::Migration[8.1]
def change
add_column :products, :part_number, :string
add_index :products, :part_number
@ -215,7 +215,7 @@ This will generate a schema migration which adds two additional columns to the
`products` table.
```ruby
class AddDetailsToProducts < ActiveRecord::Migration[8.0]
class AddDetailsToProducts < ActiveRecord::Migration[8.1]
def change
add_column :products, :part_number, :string
add_column :products, :price, :decimal
@ -236,7 +236,7 @@ $ bin/rails generate migration RemovePartNumberFromProducts part_number:string
This will generate the appropriate [`remove_column`][] statements:
```ruby
class RemovePartNumberFromProducts < ActiveRecord::Migration[8.0]
class RemovePartNumberFromProducts < ActiveRecord::Migration[8.1]
def change
remove_column :products, :part_number, :string
end
@ -265,7 +265,7 @@ $ bin/rails generate migration AddUserRefToProducts user:references
generates the following [`add_reference`][] call:
```ruby
class AddUserRefToProducts < ActiveRecord::Migration[8.0]
class AddUserRefToProducts < ActiveRecord::Migration[8.1]
def change
add_reference :products, :user, null: false, foreign_key: true
end
@ -302,7 +302,7 @@ $ bin/rails generate migration CreateJoinTableUserProduct user product
will produce the following migration:
```ruby
class CreateJoinTableUserProduct < ActiveRecord::Migration[8.0]
class CreateJoinTableUserProduct < ActiveRecord::Migration[8.1]
def change
create_join_table :users, :products do |t|
# t.index [:user_id, :product_id]
@ -336,7 +336,7 @@ $ bin/rails generate model Product name:string description:text
This will create a migration that looks like this:
```ruby
class CreateProducts < ActiveRecord::Migration[8.0]
class CreateProducts < ActiveRecord::Migration[8.1]
def change
create_table :products do |t|
t.string :name
@ -367,7 +367,7 @@ $ bin/rails generate migration AddDetailsToProducts 'price:decimal{5,2}' supplie
will produce a migration that looks like this
```ruby
class AddDetailsToProducts < ActiveRecord::Migration[8.0]
class AddDetailsToProducts < ActiveRecord::Migration[8.1]
def change
add_column :products, :price, :decimal, precision: 5, scale: 2
add_reference :products, :supplier, polymorphic: true
@ -441,7 +441,7 @@ you. You can change the name of the column with the `:primary_key` option, like
below:
```ruby
class CreateUsers < ActiveRecord::Migration[8.0]
class CreateUsers < ActiveRecord::Migration[8.1]
def change
create_table :users, primary_key: "user_id" do |t|
t.string :username
@ -467,7 +467,7 @@ You can also pass an array to `:primary_key` for a composite primary key. Read
more about [composite primary keys](active_record_composite_primary_keys.html).
```ruby
class CreateUsers < ActiveRecord::Migration[8.0]
class CreateUsers < ActiveRecord::Migration[8.1]
def change
create_table :users, primary_key: [:id, :name] do |t|
t.string :name
@ -481,7 +481,7 @@ end
If you don't want a primary key at all, you can pass the option `id: false`.
```ruby
class CreateUsers < ActiveRecord::Migration[8.0]
class CreateUsers < ActiveRecord::Migration[8.1]
def change
create_table :users, id: false do |t|
t.string :username
@ -529,7 +529,7 @@ with large databases. Currently only the MySQL and PostgreSQL adapters support
comments.
```ruby
class AddDetailsToProducts < ActiveRecord::Migration[8.0]
class AddDetailsToProducts < ActiveRecord::Migration[8.1]
def change
add_column :products, :price, :decimal, precision: 8, scale: 2, comment: "The price of the product in USD"
add_column :products, :stock_quantity, :integer, comment: "The current stock quantity of the product"
@ -803,7 +803,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[8.0]
class CreateProducts < ActiveRecord::Migration[8.1]
def change
create_table :products, primary_key: [:customer_id, :product_sku] do |t|
t.integer :customer_id
@ -824,7 +824,7 @@ If the helpers provided by Active Record aren't enough, you can use the
[`execute`][] method to execute SQL commands. For example,
```ruby
class UpdateProductPrices < ActiveRecord::Migration[8.0]
class UpdateProductPrices < ActiveRecord::Migration[8.1]
def up
execute "UPDATE products SET price = 'free'"
end
@ -945,7 +945,7 @@ how to reverse, then you can use `reversible` to specify what to do when running
a migration and what else to do when reverting it.
```ruby
class ChangeProductsPrice < ActiveRecord::Migration[8.0]
class ChangeProductsPrice < ActiveRecord::Migration[8.1]
def change
reversible do |direction|
change_table :products do |t|
@ -964,7 +964,7 @@ to an integer when the migration is reverted. Notice the block being passed to
Alternatively, you can use `up` and `down` instead of `change`:
```ruby
class ChangeProductsPrice < ActiveRecord::Migration[8.0]
class ChangeProductsPrice < ActiveRecord::Migration[8.1]
def up
change_table :products do |t|
t.change :price, :string
@ -985,7 +985,7 @@ ActiveRecord methods. 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[8.0]
class ExampleMigration < ActiveRecord::Migration[8.1]
def change
create_table :distributors do |t|
t.string :zipcode
@ -1036,7 +1036,7 @@ reverse order they were made in the `up` method. The example in the `reversible`
section is equivalent to:
```ruby
class ExampleMigration < ActiveRecord::Migration[8.0]
class ExampleMigration < ActiveRecord::Migration[8.1]
def up
create_table :distributors do |t|
t.string :zipcode
@ -1073,7 +1073,7 @@ In such cases, you can raise `ActiveRecord::IrreversibleMigration` in your
`down` block.
```ruby
class IrreversibleMigrationExample < ActiveRecord::Migration[8.0]
class IrreversibleMigrationExample < ActiveRecord::Migration[8.1]
def up
drop_table :example_table
end
@ -1095,7 +1095,7 @@ You can use Active Record's ability to rollback migrations using the
```ruby
require_relative "20121212123456_example_migration"
class FixupExampleMigration < ActiveRecord::Migration[8.0]
class FixupExampleMigration < ActiveRecord::Migration[8.1]
def change
revert ExampleMigration
@ -1113,7 +1113,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[8.0]
class DontUseDistributorsViewMigration < ActiveRecord::Migration[8.1]
def change
revert do
# copy-pasted code from ExampleMigration
@ -1238,7 +1238,7 @@ these situations you can turn the automatic transactions off with
`disable_ddl_transaction!`:
```ruby
class ChangeEnum < ActiveRecord::Migration[8.0]
class ChangeEnum < ActiveRecord::Migration[8.1]
disable_ddl_transaction!
def up
@ -1352,7 +1352,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[8.0]
class CreateProducts < ActiveRecord::Migration[8.1]
def change
suppress_messages do
create_table :products do |t|
@ -1491,7 +1491,7 @@ look at this file you'll find that it looks an awful lot like one very big
migration:
```ruby
ActiveRecord::Schema[8.0].define(version: 2008_09_06_171750) do
ActiveRecord::Schema[8.1].define(version: 2008_09_06_171750) do
create_table "authors", force: true do |t|
t.string "name"
t.datetime "created_at"
@ -1589,7 +1589,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[8.0]
class AddInitialProducts < ActiveRecord::Migration[8.1]
def up
5.times do |i|
Product.create(name: "Product ##{i}", description: "A product.")
@ -1724,7 +1724,7 @@ to enable the pgcrypto extension to access the `gen_random_uuid()` function.
```
```ruby
class CreateAuthors < ActiveRecord::Migration[8.0]
class CreateAuthors < ActiveRecord::Migration[8.1]
def change
create_table :authors, id: :uuid do |t|
t.timestamps
@ -1779,4 +1779,3 @@ Instead, consider using the
gem provides a framework for creating and managing data migrations and other
maintenance tasks in a way that is safe and easy to manage without interfering
with schema migrations.

View File

@ -102,7 +102,7 @@ NOTE: You need to enable the `hstore` extension to use hstore.
```ruby
# db/migrate/20131009135255_create_profiles.rb
class CreateProfiles < ActiveRecord::Migration[8.0]
class CreateProfiles < ActiveRecord::Migration[8.1]
enable_extension 'hstore' unless extension_enabled?('hstore')
create_table :profiles do |t|
t.hstore 'settings'

View File

@ -44,7 +44,7 @@ Without associations, creating and deleting books for that author would require
a tedious and manual process. Here's what that would look like:
```ruby
class CreateAuthors < ActiveRecord::Migration[8.0]
class CreateAuthors < ActiveRecord::Migration[8.1]
def change
create_table :authors do |t|
t.string :name
@ -193,7 +193,7 @@ Rails will look for a class named `Authors` instead of `Author`.
The corresponding migration might look like this:
```ruby
class CreateBooks < ActiveRecord::Migration[8.0]
class CreateBooks < ActiveRecord::Migration[8.1]
def change
create_table :authors do |t|
t.string :name
@ -435,7 +435,7 @@ is declared.
The corresponding migration might look like this:
```ruby
class CreateSuppliers < ActiveRecord::Migration[8.0]
class CreateSuppliers < ActiveRecord::Migration[8.1]
def change
create_table :suppliers do |t|
t.string :name
@ -653,7 +653,7 @@ model is pluralized when declaring a `has_many` association.
The corresponding migration might look like this:
```ruby
class CreateAuthors < ActiveRecord::Migration[8.0]
class CreateAuthors < ActiveRecord::Migration[8.1]
def change
create_table :authors do |t|
t.string :name
@ -985,7 +985,7 @@ Diagram](images/association_basics/has_many_through.png)
The corresponding migration might look like this:
```ruby
class CreateAppointments < ActiveRecord::Migration[8.0]
class CreateAppointments < ActiveRecord::Migration[8.1]
def change
create_table :physicians do |t|
t.string :name
@ -1017,7 +1017,7 @@ key](active_record_composite_primary_keys.html) for the join table in the
`has_many :through` relationship like below:
```ruby
class CreateAppointments < ActiveRecord::Migration[8.0]
class CreateAppointments < ActiveRecord::Migration[8.1]
def change
# ...
create_table :appointments, primary_key: [:physician_id, :patient_id] do |t|
@ -1128,7 +1128,7 @@ Diagram](images/association_basics/has_one_through.png)
The corresponding migration to set up these associations might look like this:
```ruby
class CreateAccountHistories < ActiveRecord::Migration[8.0]
class CreateAccountHistories < ActiveRecord::Migration[8.1]
def change
create_table :suppliers do |t|
t.string :name
@ -1183,7 +1183,7 @@ manage the relationship between the associated records. The corresponding
migration might look like this:
```ruby
class CreateAssembliesAndParts < ActiveRecord::Migration[8.0]
class CreateAssembliesAndParts < ActiveRecord::Migration[8.1]
def change
create_table :assemblies do |t|
t.string :name
@ -1468,7 +1468,7 @@ To implement these associations, you'll need to create the corresponding
database tables and set up the foreign key. Here's an example migration:
```ruby
class CreateSuppliers < ActiveRecord::Migration[8.0]
class CreateSuppliers < ActiveRecord::Migration[8.1]
def change
create_table :suppliers do |t|
t.string :name
@ -1604,7 +1604,7 @@ foreign key column (`imageable_id`) and a type column (`imageable_type`) in the
model:
```ruby
class CreatePictures < ActiveRecord::Migration[8.0]
class CreatePictures < ActiveRecord::Migration[8.1]
def change
create_table :pictures do |t|
t.string :name
@ -1628,7 +1628,7 @@ recommended to use `t.references` or its alias `t.belong_to` and specify
it automatically adds both the foreign key and type columns to the table.
```ruby
class CreatePictures < ActiveRecord::Migration[8.0]
class CreatePictures < ActiveRecord::Migration[8.1]
def change
create_table :pictures do |t|
t.string :name
@ -1701,7 +1701,7 @@ To support this relationship, we need to add a `manager_id` column to the
manager).
```ruby
class CreateEmployees < ActiveRecord::Migration[8.0]
class CreateEmployees < ActiveRecord::Migration[8.1]
def change
create_table :employees do |t|
# Add a belongs_to reference to the manager, which is an employee.
@ -2173,7 +2173,7 @@ the books table. For a brand new table, the migration might look something like
this:
```ruby
class CreateBooks < ActiveRecord::Migration[8.0]
class CreateBooks < ActiveRecord::Migration[8.1]
def change
create_table :books do |t|
t.datetime :published_at
@ -2187,7 +2187,7 @@ end
Whereas for an existing table, it might look like this:
```ruby
class AddAuthorToBooks < ActiveRecord::Migration[8.0]
class AddAuthorToBooks < ActiveRecord::Migration[8.1]
def change
add_reference :books, :author
end
@ -2227,7 +2227,7 @@ You can then fill out the migration and ensure that the table is created without
a primary key.
```ruby
class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[8.0]
class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[8.1]
def change
create_table :assemblies_parts, id: false do |t|
t.bigint :assembly_id
@ -2248,7 +2248,7 @@ are you forgot to set `id: false` when creating your migration.
For simplicity, you can also use the method `create_join_table`:
```ruby
class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[8.0]
class CreateAssembliesPartsJoinTable < ActiveRecord::Migration[8.1]
def change
create_join_table :assemblies, :parts do |t|
t.index :assembly_id
@ -2268,7 +2268,7 @@ The main difference in schema implementation between creating a join table for
`has_many :through` requires an `id`.
```ruby
class CreateAppointments < ActiveRecord::Migration[8.0]
class CreateAppointments < ActiveRecord::Migration[8.1]
def change
create_table :appointments do |t|
t.belongs_to :physician
@ -3134,7 +3134,7 @@ Although the `:counter_cache` option is specified on the model with the
`books_count` column to the `Author` model:
```ruby
class AddBooksCountToAuthors < ActiveRecord::Migration[8.0]
class AddBooksCountToAuthors < ActiveRecord::Migration[8.1]
def change
add_column :authors, :books_count, :integer, default: 0, null: false
end

View File

@ -182,7 +182,7 @@ With no further work, `bin/rails server` will run our new shiny Rails app:
$ cd my_app
$ bin/rails server
=> Booting Puma
=> Rails 8.0.0 application starting in development
=> Rails 8.1.0 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 6.4.0 (ruby 3.1.3-p185) ("The Eagle of Durango")
@ -414,7 +414,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 8.0.0)
Loading development environment in sandbox (Rails 8.1.0)
Any modifications you make will be rolled back on exit
irb(main):001:0>
```
@ -527,7 +527,7 @@ $ bin/rails destroy model Oops
```bash
$ bin/rails about
About your application's environment
Rails version 8.0.0
Rails version 8.1.0
Ruby version 3.2.0 (x86_64-linux)
RubyGems version 3.3.7
Rack version 3.0.8

View File

@ -58,6 +58,8 @@ NOTE: If you need to apply configuration directly to a class, use a [lazy load h
Below are the default values associated with each target version. In cases of conflicting values, newer versions take precedence over older versions.
#### Default Values for Target Version 8.1
#### Default Values for Target Version 8.0
- [`config.action_dispatch.strict_freshness`](#config-action-dispatch-strict-freshness): `true`

View File

@ -607,7 +607,7 @@ To ease the upgrade it's required to add the new default to the
value:
```ruby
# new_framework_defaults_8_0.rb.tt
# new_framework_defaults_8_1.rb.tt
# Rails.application.config.active_job.existing_behavior = false
```

View File

@ -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-8.0.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-8.1.0.alpha/lib/action_controller/metal/basic_implicit_render.rb:6
# and 72 frames (use `bt' command for all frames)
(rdbg)
```
@ -445,13 +445,13 @@ 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-2.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-8.0.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-8.0.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-8.0.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-8.0.0.alpha/lib/active_support/callbacks.rb:118
#6 ActionText::Rendering::ClassMethods#with_renderer(renderer=#<PostsController:0x0000000000af78>) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actiontext-8.0.0.alpha/lib/action_text/rendering.rb:20
#7 block {|controller=#<PostsController:0x0000000000af78>, action=#<Proc:0x00007fd91985f1c0 /Users/st0012/...|} in <class:Engine> (4 levels) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actiontext-8.0.0.alpha/lib/action_text/engine.rb:69
#8 [C] BasicObject#instance_exec at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/activesupport-8.0.0.alpha/lib/active_support/callbacks.rb:127
#2 AbstractController::Base#process_action(method_name="index", args=[]) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actionpack-8.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-8.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-8.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-8.1.0.alpha/lib/active_support/callbacks.rb:118
#6 ActionText::Rendering::ClassMethods#with_renderer(renderer=#<PostsController:0x0000000000af78>) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actiontext-8.1.0.alpha/lib/action_text/rendering.rb:20
#7 block {|controller=#<PostsController:0x0000000000af78>, action=#<Proc:0x00007fd91985f1c0 /Users/st0012/...|} in <class:Engine> (4 levels) at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/actiontext-8.1.0.alpha/lib/action_text/engine.rb:69
#8 [C] BasicObject#instance_exec at ~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/activesupport-8.1.0.alpha/lib/active_support/callbacks.rb:127
..... and more
```

View File

@ -330,6 +330,11 @@
description: >
This guide provides steps to be followed when you upgrade your
applications to a newer version of Ruby on Rails.
-
name: Version 8.1 - ?
url: 8_1_release_notes.html
description: Release notes for Rails 8.1.
work_in_progress: true
-
name: Version 8.0 - ?
url: 8_0_release_notes.html

View File

@ -136,10 +136,10 @@ run the following in a new terminal:
```bash
$ rails --version
Rails 8.0.0
Rails 8.1.0
```
If it says something like "Rails 8.0.0", you are ready to continue.
If it says something like "Rails 8.1.0", you are ready to continue.
### Creating the Blog Application
@ -413,7 +413,7 @@ database-agnostic.
Let's take a look at the contents of our new migration file:
```ruby
class CreateArticles < ActiveRecord::Migration[8.0]
class CreateArticles < ActiveRecord::Migration[8.1]
def change
create_table :articles do |t|
t.string :title
@ -474,7 +474,7 @@ $ bin/rails console
You should see a rails console prompt like:
```irb
Loading development environment (Rails 8.0.0)
Loading development environment (Rails 8.1.0)
blog(dev)>
```
@ -1352,7 +1352,7 @@ In addition to the model, Rails has also made a migration to create the
corresponding database table:
```ruby
class CreateComments < ActiveRecord::Migration[8.0]
class CreateComments < ActiveRecord::Migration[8.1]
def change
create_table :comments do |t|
t.string :commenter

View File

@ -114,7 +114,7 @@ You can open the terminal within VS Code to verify that Rails is installed:
```bash
$ rails --version
Rails 8.0.0
Rails 8.1.0
```
You can now continue with the [Getting Started guide](getting_started.html#hello-rails) and

View File

@ -58,7 +58,7 @@
Version:
<select class="guides-version">
<option value="https://edgeguides.rubyonrails.org/"<%= " selected" if @edge %>>Edge</option>
<% %w[7.2 7.1 7.0 6.1 6.0 5.2 5.1 5.0 4.2 4.1 4.0 3.2 3.1 3.0 2.3].each do |version| %>
<% %w[8.0 7.2 7.1 7.0 6.1 6.0 5.2 5.1 5.0 4.2 4.1 4.0 3.2 3.1 3.0 2.3].each do |version| %>
<option value="https://guides.rubyonrails.org/v<%= version %>/"<%= " selected" if @version&.start_with?("v#{version}") %>><%= version %></option>
<% end %>
</select>

View File

@ -77,6 +77,12 @@ The new Rails version might have different configuration defaults than the previ
To allow you to upgrade to new defaults one by one, the update task has created a file `config/initializers/new_framework_defaults_X.Y.rb` (with the desired Rails version in the filename). You should enable the new configuration defaults by uncommenting them in the file; this can be done gradually over several deployments. Once your application is ready to run with new defaults, you can remove this file and flip the `config.load_defaults` value.
Upgrading from Rails 8.0 to Rails 8.1
-------------------------------------
For more information on changes made to Rails 8.1 please see the [release notes](8_1_release_notes.html).
Upgrading from Rails 7.2 to Rails 8.0
-------------------------------------

View File

@ -1,210 +1,2 @@
## Rails 8.0.0.rc1 (October 19, 2024) ##
* Remove deprecated support to extend Rails console through `Rails::ConsoleMethods`.
*Rafael Mendonça França*
* Remove deprecated file `rails/console/helpers`.
*Rafael Mendonça França*
* Remove deprecated file `rails/console/app`.
*Rafael Mendonça França*
* Remove deprecated `config.read_encrypted_secrets`.
*Rafael Mendonça França*
* Add Kamal support for devcontainers
Previously generated devcontainer could not use docker and therefore Kamal.
*Joé Dupuis*
## Rails 8.0.0.beta1 (September 26, 2024) ##
* Exit `rails g` with code 1 if generator could not be found.
Previously `rails g` returned 0, which would make it harder to catch typos in scripts calling `rails g`.
*Christopher Özbek*
* Remove `require_*` statements from application.css to align with the transition from Sprockets to Propshaft.
With Propshaft as the default asset pipeline in Rails 8, the require_tree and require_self clauses in application.css are no longer necessary, as they were specific to Sprockets. Additionally, the comment has been updated to clarify that CSS precedence now follows standard cascading order without automatic prioritization by the asset pipeline.
*Eduardo Alencar*
* Do not include redis by default in generated Dev Containers.
Now that applications use the Solid Queue and Solid Cache gems by default, we do not need to include redis
in the Dev Container. We will only include redis if `--skip-solid` is used when generating an app that uses
Active Job or Action Cable.
When generating a Dev Container for an existing app, we will not include redis if either of the solid gems
are in use.
*Andrew Novoselac*
* Use [Solid Cable](https://github.com/rails/solid_cable) as the default Action Cable adapter in production, configured as a separate queue database in config/database.yml. It keeps messages in a table and continuously polls for updates. This makes it possible to drop the common dependency on Redis, if it isn't needed for any other purpose. Despite polling, the performance of Solid Cable is comparable to Redis in most situations. And in all circumstances, it makes it easier to deploy Rails when Redis is no longer a required dependency for Action Cable functionality.
*DHH*
* Use [Solid Queue](https://github.com/rails/solid_queue) as the default Active Job backend in production, configured as a separate queue database in config/database.yml. In a single-server deployment, it'll run as a Puma plugin. This is configured in `config/deploy.yml` and can easily be changed to use a dedicated jobs machine.
*DHH*
* Use [Solid Cache](https://github.com/rails/solid_cache) as the default Rails.cache backend in production, configured as a separate cache database in config/database.yml.
*DHH*
* Add Rails::Rack::SilenceRequest middleware and use it via `config.silence_healthcheck_path = path`
to silence requests to "/up". This prevents the Kamal-required health checks from clogging up
the production logs.
*DHH*
* Introduce `mariadb-mysql` and `mariadb-trilogy` database options for `rails new`
When used with the `--devcontainer` flag, these options will use `mariadb` as the database for the
Dev Container. The original `mysql` and `trilogy` options will use `mysql`. Users who are not
generating a Dev Container do not need to use the new options.
*Andrew Novoselac*
* Deprecate `::STATS_DIRECTORIES`.
The global constant `STATS_DIRECTORIES` has been deprecated in favor of
`Rails::CodeStatistics.register_directory`.
Add extra directories with `Rails::CodeStatistics.register_directory(label, path)`:
```ruby
require "rails/code_statistics"
Rails::CodeStatistics.register_directory('My Directory', 'path/to/dir')
```
*Petrik de Heus*
* Enable query log tags by default on development env
This can be used to trace troublesome SQL statements back to the application
code that generated these statements. It is also useful when using multiple
databases because the query logs can identify which database is being used.
*Matheus Richard*
* Defer route drawing to the first request, or when url_helpers are called
Executes the first routes reload in middleware, or when a route set's
url_helpers receives a route call / asked if it responds to a route.
Previously, this was executed unconditionally on boot, which can
slow down boot time unnecessarily for larger apps with lots of routes.
Environments like production that have `config.eager_load = true` will
continue to eagerly load routes on boot.
*Gannon McGibbon*
* Generate form helpers to use `textarea*` methods instead of `text_area*` methods
*Sean Doyle*
* Add authentication generator to give a basic start to an authentication system using database-tracked sessions and password reset.
Generate with...
```
bin/rails generate authentication
```
Generated files:
```
app/models/current.rb
app/models/user.rb
app/models/session.rb
app/controllers/sessions_controller.rb
app/controllers/passwords_controller.rb
app/mailers/passwords_mailer.rb
app/views/sessions/new.html.erb
app/views/passwords/new.html.erb
app/views/passwords/edit.html.erb
app/views/passwords_mailer/reset.html.erb
app/views/passwords_mailer/reset.text.erb
db/migrate/xxxxxxx_create_users.rb
db/migrate/xxxxxxx_create_sessions.rb
test/mailers/previews/passwords_mailer_preview.rb
```
*DHH*
* Add not-null type modifier to migration attributes.
Generating with...
```
bin/rails generate migration CreateUsers email_address:string!:uniq password_digest:string!
```
Produces:
```ruby
class CreateUsers < ActiveRecord::Migration[8.0]
def change
create_table :users do |t|
t.string :email_address, null: false
t.string :password_digest, null: false
t.timestamps
end
add_index :users, :email_address, unique: true
end
end
```
*DHH*
* Add a `script` folder to applications, and a scripts generator.
The new `script` folder is meant to hold one-off or general purpose scripts,
such as data migration scripts, cleanup scripts, etc.
A new script generator allows you to create such scripts:
```
bin/rails generate script my_script
bin/rails generate script data/backfill
```
You can run the generated script using:
```
bundle exec ruby script/my_script.rb
bundle exec ruby script/data/backfill.rb
```
*Jerome Dalbert*, *Haroon Ahmed*
* Deprecate `bin/rake stats` in favor of `bin/rails stats`.
*Juan Vásquez*
* Add internal page `/rails/info/notes`, that displays the same information as `bin/rails notes`.
*Deepak Mahakale*
* Add Rubocop and GitHub Actions to plugin generator.
This can be skipped using --skip-rubocop and --skip-ci.
*Chris Oliver*
* Use Kamal for deployment by default, which includes generating a Rails-specific config/deploy.yml.
This can be skipped using --skip-kamal. See more: https://kamal-deploy.org/
*DHH*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/railties/CHANGELOG.md) for previous changes.
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/railties/CHANGELOG.md) for previous changes.

View File

@ -344,6 +344,8 @@ module Rails
if respond_to?(:action_dispatch)
action_dispatch.strict_freshness = true
end
when "8.1"
load_defaults "8.0"
else
raise "Unknown version #{target_version.to_s.inspect}"
end

View File

@ -8,9 +8,9 @@ module Rails
module VERSION
MAJOR = 8
MINOR = 0
MINOR = 1
TINY = 0
PRE = "rc1"
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end

View File

@ -1,25 +0,0 @@
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 8.0 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults` to `8.0`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
###
# Specifies whether `to_time` methods preserve the UTC offset of their receivers or preserves the timezone.
# If set to `:zone`, `to_time` methods will use the timezone of their receivers.
# If set to `:offset`, `to_time` methods will use the UTC offset.
# If `false`, `to_time` methods will convert to the local system UTC offset instead.
#++
# Rails.application.config.active_support.to_time_preserves_timezone = :zone
###
# When both `If-Modified-Since` and `If-None-Match` are provided by the client
# only consider `If-None-Match` as specified by RFC 7232 Section 6.
# If set to `false` both conditions need to be satisfied.
#++
# Rails.application.config.action_dispatch.strict_freshness = true

View File

@ -0,0 +1,10 @@
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 8.1 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults` to `8.1`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html

View File

@ -108,6 +108,9 @@ class Releaser < Rake::TaskLib
end
end
desc "Update version of the frameworks"
task update_versions: FRAMEWORKS.map { |f| "#{f}:update_versions" } + ["rails:update_versions"]
desc "Build gem files for all projects"
task build: FRAMEWORKS.map { |f| "#{f}:build" } + ["rails:build"]

View File

@ -143,17 +143,24 @@
fastq "^1.6.0"
"@rails/actioncable@file:/workspaces/rails/actioncable":
version "8.0.0-rc1"
version "8.1.0-alpha"
resolved "file:actioncable"
"@rails/actiontext@file:/workspaces/rails/actiontext":
version "8.0.0-rc1"
version "8.1.0-alpha"
resolved "file:actiontext"
dependencies:
"@rails/activestorage" ">= 8.0.0-alpha"
"@rails/activestorage@>= 8.0.0-alpha", "@rails/activestorage@file:/workspaces/rails/activestorage":
"@rails/activestorage@>= 8.0.0-alpha":
version "8.0.0-rc1"
resolved "https://registry.npmjs.org/@rails/activestorage/-/activestorage-8.0.0-rc1.tgz"
integrity sha512-gI2Ij7mDN3d/MCPebE67hL30Y9I5reGvMWGOhFzvz0JMnf7n5U+tm1/B68Vm801g/vsbeLM+RtkuDSl+OZee9w==
dependencies:
spark-md5 "^3.0.1"
"@rails/activestorage@file:/workspaces/rails/activestorage":
version "8.1.0-alpha"
resolved "file:activestorage"
dependencies:
spark-md5 "^3.0.1"