The `Sidekiq::Logging` module was removed in Sidekiq 6.0 in favour of
`Sidekiq.logger=`.
https://github.com/mperham/sidekiq/wiki/Logging#api-changes
> The old Sidekiq::Logging class was removed in Sidekiq 6.0. You should
> not be accessing any Sidekiq internal classes to use the logger. Use
> `logger` directly in your Worker or use `Sidekiq.logger` elsewhere.
- Ensure that explicit method call `connected_to` with `prevent_writes: false`
turns off 'preventing writes' in the passed block.
- Ensure that after explicit call method call `connected_to` with `prevent_writes: false`
'preventing writes' is retained
Related to https://github.com/rails/rails/pull/37065
If a user is using the middleware for swapping database connections and
manually calling `connected_to` in a controller/model/etc without
calling `while_preventing_writes(false)` there is potential for a race
condition where writes will be blocked.
While the user could _just_ call `while_preventing_writes` in the same
place they call `connected_to` this would mean that all cases need to
call two methods.
This PR changes `connected_to` to call `while_preventing_writes`
directly. By default we'll assume you don't want to prevent writes, but
if called with `connected_to(role: :writing, prevent_writes: true)` or
from the middleware (which calls `connected_to` this way) the writes
will be blocked.
For replicas, apps should use readonly users to enforce not writing
rather than `while_preventing_writes` directly.
Should fix the remaining issues in
https://github.com/rails/rails/issues/36830
For example, HasManyThroughSourceAssociationNotFoundError uses
to_sentence to create its message, but was hardcoded to use the `en`
locale. In cases where this locale did not exist, this caused the
exception to be suppressed in favour of an I18n::InvalidLocale
exception.
This change removes the hardcoded locale, which allows I18n to use its
default locale.
- The controller created in the guides explaining rails engines is Blorgh::ArticlesController
- This was the single occurrence where controller name was incorrectly specified
- Changed to Blorgh::ArticlesController instead of Blorgh::ArticleController
Prevent `ActiveSupport::Duration.build(value)` from creating instances of
`ActiveSupport::Duration` unless `value` is of type `Numeric`.
Addresses the errant set of behaviours described in #37012 where
`ActiveSupport::Duration` comparisons would fail confusingly
or return unexpected results when comparing durations built from instances of `String`.
Before:
small_duration_from_string = ActiveSupport::Duration.build('9')
large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
small_duration_from_int = ActiveSupport::Duration.build(9)
large_duration_from_string > small_duration_from_string
=> false
small_duration_from_string == small_duration_from_int
=> false
small_duration_from_int < large_duration_from_string
=> ArgumentError (comparison of ActiveSupport::Duration::Scalar
with ActiveSupport::Duration failed)
large_duration_from_string > small_duration_from_int
=> ArgumentError (comparison of String with ActiveSupport::Duration failed)
After:
small_duration_from_string = ActiveSupport::Duration.build('9')
=> TypeError (can't build an `ActiveSupport::Duration` from a `String`)
Rails 6.0 introduces parallel testing and the default degree of parallelism is configured based on the number of CPU.
refer https://github.com/rails/rails/pull/34735https://github.com/rails/rails/pull/31900
When any minitest executed under the OS where 2 or more CPU available,
SQLite 3 database files are not git-ignored.
Also updated other files which ignores SQLite database files.
* Steps to reproduce
```
$ git clone https://github.com/yahonda/rep_ignore_sqlite3_databases.git
$ cd rep_ignore_sqlite3_databases/
$ bin/rails test
$ git status
```
* Expected behavior:
- No `Untracked files:`
* Actual behavior:
- SQLite 3 database files appeared
```
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
db/test.sqlite3-0
db/test.sqlite3-1
db/test.sqlite3-2
db/test.sqlite3-3
db/test.sqlite3-4
db/test.sqlite3-5
nothing added to commit but untracked files present (use "git add" to track)
$
```
When updating our app for 9def05385f, I
found several incorrectly configured validations that looked like this:
validates :name, uniqueness: true, case_sensitive: false
The intent is clearly for `case_sensitive: false` to be passed as an
option to the uniqueness validator, but instead it's being passed as
its own separate validation. Because the value `false` disables the
validation, the validator class isn't loaded and the failure is silent.
The validator should always be loaded, even if it's disabled, to ensure
it exists and avoid configuration errors like the one described above.