Minor text / error message tweaks, fixes, and punctuation

Improve a few sentences and add punctuation to some recent changelog &
guide entries.

[ci skip]
This commit is contained in:
Carlos Antonio da Silva 2024-03-25 10:19:42 -03:00
parent 2ee11cd0b7
commit 61a3e61e77
5 changed files with 17 additions and 18 deletions

View File

@ -1,11 +1,11 @@
* Allow association's `foreign_key` to be composite
* Allow association's `foreign_key` to be composite.
`query_constraints` option was the only way to configure a composite foreign key by passing an `Array`.
Now it's possible to pass an Array value as `foreign_key` to achieve the same behavior of an association.
*Nikita Vasilevsky*
* Allow association's `primary_key` to be composite
* Allow association's `primary_key` to be composite.
Association's `primary_key` can be composite when derived from associated model `primary_key` or `query_constraints`.
Now it's possible to explicitly set it as composite on the association.
@ -16,7 +16,7 @@
Controls whether `ActiveRecord::Base.connection` raises an error, emits a deprecation warning, or neither.
`ActiveRecord::Base.connection` checkouts a database connection from the pool and keep it leased until the end of
`ActiveRecord::Base.connection` checkouts a database connection from the pool and keeps it leased until the end of
the request or job. This behavior can be undesirable in environments that use many more threads or fibers than there
is available connections.
@ -27,7 +27,7 @@
*Jean Boussier*
* Add dirties option to uncached
* Add dirties option to uncached.
This adds a `dirties` option to `ActiveRecord::Base.uncached` and
`ActiveRecord::ConnectionAdapters::ConnectionPool#uncached`.
@ -39,7 +39,7 @@
*Donal McBreen*
* Deprecate `ActiveRecord::Base.connection` in favor of `.lease_connection`
* Deprecate `ActiveRecord::Base.connection` in favor of `.lease_connection`.
The method has been renamed as `lease_connection` to better reflect that the returned
connection will be held for the duration of the request or job.
@ -49,14 +49,14 @@
*Jean Boussier*
* Deprecate `ActiveRecord::ConnectionAdapters::ConnectionPool#connection`
* Deprecate `ActiveRecord::ConnectionAdapters::ConnectionPool#connection`.
The method has been renamed as `lease_connection` to better reflect that the returned
connection will be held for the duration of the request or job.
*Jean Boussier*
* Expose a generic fixture accessor for fixture names that may conflict with Minitest
* Expose a generic fixture accessor for fixture names that may conflict with Minitest.
```ruby
assert_equal "Ruby on Rails", web_sites(:rubyonrails).name

View File

@ -303,7 +303,7 @@ module ActiveRecord
@permanent_connection_checkout = true
singleton_class.attr_reader :permanent_connection_checkout
# Defines whether +ActiveRecord::Base.connection+ is allowed, deprecated or entirely disallowed
# Defines whether +ActiveRecord::Base.connection+ is allowed, deprecated, or entirely disallowed.
def self.permanent_connection_checkout=(value)
unless [true, :deprecated, :disallowed].include?(value)
raise ArgumentError, "permanent_connection_checkout must be one of: `true`, `:deprecated` or `:disallowed`"

View File

@ -263,13 +263,13 @@ module ActiveRecord
case ActiveRecord.permanent_connection_checkout
when :deprecated
ActiveRecord.deprecator.warn <<~MESSAGE
Called deprecated `ActionRecord::Base.connection`method.
Called deprecated `ActionRecord::Base.connection` method.
Either use `with_connection` or `lease_connection`.
MESSAGE
when :disallowed
raise ActiveRecordError, <<~MESSAGE
Called deprecated `ActionRecord::Base.connection`method.
Called deprecated `ActionRecord::Base.connection` method.
Either use `with_connection` or `lease_connection`.
MESSAGE

View File

@ -1054,7 +1054,7 @@ Controls whether migrations are numbered with serial integers or with timestamps
#### `config.active_record.automatically_invert_plural_associations`
Controls whether Active Record will automatically look for an inverse relations with a pluralized name.
Controls whether Active Record will automatically look for inverse relations with a pluralized name.
Example:
@ -1076,7 +1076,6 @@ it may cause backward compatibility issues with legacy code that doesn't expect
This behavior can be disabled on a per-model basis:
```ruby
class Comment < ApplicationRecord
self.automatically_invert_plural_associations = false
@ -1089,7 +1088,7 @@ And on a per-association basis:
```ruby
class Comment < ApplicationRecord
self.automatically_invert_plural_associations = false
self.automatically_invert_plural_associations = true
belongs_to :post, inverse_of: false
end
@ -1575,14 +1574,14 @@ record.token # => "fwZcXX6SkJBJRogzMdciS7wf"
Controls whether `ActiveRecord::Base.connection` raises an error, emits a deprecation warning, or neither.
`ActiveRecord::Base.connection` checkouts a database connection from the pool and keep it leased until the end of
`ActiveRecord::Base.connection` checkouts a database connection from the pool and keeps it leased until the end of
the request or job. This behavior can be undesirable in environments that use many more threads or fibers than there
is available connections.
This configuration can be used to track down and eliminate code that calls `ActiveRecord::Base.connection` and
migrate it to use `ActiveRecord::Base.with_connection` instead.
The value can be set to `:disallowed`, `:deprecated` or `true` to respectively raise an error, emit a deprecation
The value can be set to `:disallowed`, `:deprecated`, or `true` to respectively raise an error, emit a deprecation
warning, or neither.
| Starting with version | The default value is |

View File

@ -29,7 +29,7 @@
# Rails.application.config.active_record.validate_migration_timestamps = true
###
# Controls whether Active Record will automatically look for an inverse relations
# Controls whether Active Record will automatically look for inverse relations
# with a pluralized name.
#
# Example:
@ -37,7 +37,7 @@
# belongs_to :post
# end
#
# In the above case Active Record will now try to infer a `:comments` relation
# on `Post`, while previously it would only look for `:comment`.
# In this example, Active Record will try to infer a `:comment` (singular) association
# on `Post`. With this option enabled, it will also look for a `:comments` association.
#++
# Rails.application.config.active_record.automatically_invert_plural_associations = true