Commit Graph

74339 Commits

Author SHA1 Message Date
Eugene Kenny 5545f6a771 Fix Active Job Sidekiq integration tests
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.
2019-09-01 23:31:21 +02:00
Richard Schneeman 782d280307
Merge pull request #37093 from connorshea/patch-1
Fix grammar for attached? method doc
2019-08-30 21:53:08 -05:00
Connor Shea 6b182ff13b
Fix grammar for attached? method doc
Attachments is plural, so it should be have.
2019-08-30 20:36:12 -06:00
Eileen M. Uchitelle 01cc0c183d
Merge pull request #37091 from bogdanvlviv/extend-test-from-37065
Extend `test_can_write_while_reading_from_replicas_if_explicit`
2019-08-30 11:09:07 -04:00
bogdanvlviv 39c6986ffc
Extend `test_can_write_while_reading_from_replicas_if_explicit`
- 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
2019-08-30 17:46:21 +03:00
Akira Matsuda ffd74f58b0 No need to stringify event names (= method names) that always are Symbols 2019-08-30 03:04:52 +09:00
eileencodes 520111096f Merge branch 'move_mysql2_out_of_abstract_adapter' 2019-08-29 09:02:54 -04:00
John Hawthorn 18c6f80960 Remove mysql2 specific rescue in abstract adapter 2019-08-29 09:02:08 -04:00
Carlos Antonio da Silva 8e1c0011e5 Fix missing close code tick mark in AR changelog [ci skip] 2019-08-29 10:00:36 -03:00
Eileen M. Uchitelle 68611f39d0
Merge pull request #37065 from eileencodes/push-while_preventing_writes-into-connected_to
Call `while_preventing_writes` from `connected_to`
2019-08-29 08:29:01 -04:00
Akira Matsuda 2ae9e5da73 US_ASCII strings are always UTF_8 compatible 2019-08-29 19:39:40 +09:00
Ryuta Kamizono 48ae1ba361
Merge pull request #37071 from giraffate/fix_docs_to_update_ruby_version_in_reference_URLs
Fix docs to update ruby version in reference URLs [ci skip]
2019-08-29 10:14:44 +09:00
Takayuki Nakata b0b375677a Fix docs to update ruby version in reference URLs [ci skip]
Rails6 requires Ruby version 2.5.0 or later.
2019-08-29 09:28:55 +09:00
Akira Matsuda 3523b9d009 Constantize a constant array in a method 2019-08-29 07:54:51 +09:00
Akira Matsuda 470bc200da This is no longer a fact in Rails 3+
[ci skip]
2019-08-29 07:30:45 +09:00
eileencodes 66bc2ff6b3 Call `while_preventing_writes` from `connected_to`
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
2019-08-28 13:44:51 -04:00
Eileen M. Uchitelle 063056b9e5
Merge pull request #37047 from dvandersluis/37044-fix-exception-message
Don't hardcode locale for to_sentence
2019-08-28 08:43:55 -04:00
Eileen M. Uchitelle 86cb6a2b2a
Merge pull request #37060 from eugeneius/clarify_maintenance_policy
Clarify severe security issues maintenance policy [ci skip]
2019-08-28 08:42:30 -04:00
Eileen M. Uchitelle 235a8b24cb
Merge pull request #37061 from eugeneius/stale_comment
Update stale issue comment to mention 6-0-stable
2019-08-28 08:36:38 -04:00
Eugene Kenny 165753163c Update stale issue comment to mention 6-0-stable
6-0-stable is the release series that currently receives bug fixes.
2019-08-28 10:56:10 +01:00
Eugene Kenny 73f3909bc2 Clarify severe security issues maintenance policy [ci skip]
It wasn't clear whether "the last major release series" meant the most
recent series in the last major version, or all series in that version.
2019-08-28 10:46:30 +01:00
प्रथमेश Sonpatki a11e63f399
Merge pull request #37057 from giraffate/fix_a_doc_to_update_postgresql_version_for_rails6
Fix a document to update postgresql version for rails6 [ci skip]
2019-08-28 13:03:37 +05:30
Takayuki Nakata 83037c0bcf Fix a document to update postgresql version for rails6 [ci skip]
In rails6, versions 9.3 and up are supported.
2019-08-28 10:06:21 +09:00
Daniel Vandersluis b99c21a015 Remove locale key for to_sentence
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.
2019-08-27 14:53:17 -04:00
Eileen M. Uchitelle ead533199e
Merge pull request #37054 from sinsoku/patch/add_doc_for_placeholder_option
Add doc about I18n support for :placeholder option [ci skip]
2019-08-27 14:45:28 -04:00
sinsoku 7b157f1409
Add doc about I18n support for :placeholder option [ci skip]
The :placeholder option accepts true, so it should be mentioned in the documentation.

Ref: https://github.com/rails/rails/pull/16438
2019-08-28 02:25:41 +09:00
Eugene Kenny a58d1d77f0
Merge pull request #37055 from akshaymohite/rails-engines-guides-fix
Changed controller name (Typo fix) in rails engines documentation [ci skip]
2019-08-27 17:39:56 +01:00
Andrew White 45fa3261eb
Merge pull request #37013 from alexeiemam/issue-37012
Prevent `ActiveSupport::Duration.build(string)` comparison bug
2019-08-27 17:38:16 +01:00
Akshay Mohite 496988ce66
Changed controller name (Typo fix) in rails engines documentation [ci skip]
- 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
2019-08-27 21:43:55 +05:30
Alexei Emam 1a48d50363 Disallow all non-numerics as Duration.build input, Fixes #37012
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`)
2019-08-27 16:58:09 +01:00
Carlos Antonio da Silva 1f325fab01
Merge pull request #37053 from yahonda/ignore_sqlite3_parallel_testing_databases
Ignore SQLite3 database files generated by parallel testing
2019-08-27 09:15:58 -03:00
Yasuo Honda c5e3c537a4 Ignore SQLite3 database files generated by parallel testing
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/34735 https://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)
$
```
2019-08-27 11:42:04 +00:00
Ryuta Kamizono b96e042fe4
Merge pull request #37052 from bogdanvlviv/fix-assertion-in-test_delete_multi
Fix assertion in `test_delete_multi`
2019-08-27 19:40:01 +09:00
bogdanvlviv 9020c78dde
Fix assertion in `test_delete_multi`
There is already assertion for existence of "foo"-entry by two lines
above, we should assert whether there is "hello"-entry instead.
2019-08-27 12:46:45 +03:00
Eugene Kenny f7049ec583
Merge pull request #37050 from quanon/fix_rdoc
Fix rdoc of ActiveRecord::Associations::CollectionProxy#replace [ci skip]
2019-08-27 04:52:08 +01:00
Shinpei Noda 21972c35e7 Fix rdoc of ActiveRecord::Associations::CollectionProxy#replace [ci skip] 2019-08-27 11:24:50 +09:00
Akira Matsuda 24f1f822e3 Giving a Symbol here might be a very little bit efficient than giving a String
since the key is goning to be converted to a Symbol later
2019-08-27 04:07:22 +09:00
Akira Matsuda 08604eeaa4 No need to dup && freeze an already frozen sql string 2019-08-27 04:07:22 +09:00
Akira Matsuda 41050e544b Skip tidying bytes for ascii_only strings 2019-08-27 04:07:22 +09:00
Akira Matsuda a79e18693b No need to count an Array because Array knows its length 2019-08-27 04:07:22 +09:00
Akira Matsuda cade89e034 Reduce Hash creation in FormHelper 2019-08-27 04:07:22 +09:00
Peter Zhu 59e746d4d0 Add `delete_multi` method 2019-08-26 09:58:03 -07:00
George Claghorn d64010fe67
Merge pull request #36454 from sunny/escape_email_addresses_with_name
Escape email addresses with name
2019-08-26 11:31:07 -04:00
Sunny Ripert 3a8dbe1746 Escape email addresses with name 2019-08-26 17:21:06 +02:00
Ryuta Kamizono cc8f72f09e
Merge pull request #37043 from giraffate/fix_docs_to_replace_http_with_https_in_activerecord
Fix docs to replace http with https in activerecord [ci skip]
2019-08-26 22:50:14 +09:00
Takayuki Nakata 37b4a3c4f0 Fix docs to replace http with https in activerecord [ci skip] 2019-08-26 22:34:33 +09:00
Ryuta Kamizono d5c36235e0
Merge pull request #37041 from eugeneius/disabled_unknown_validator
Always load validator class to verify it exists
2019-08-26 21:04:34 +09:00
Eugene Kenny d2e2ca0d0f Always load validator class to verify it exists
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.
2019-08-26 11:52:34 +01:00
Eugene Kenny 730a661ad9
Merge pull request #28862 from georgemillo/show_detailed_exceptions
fix docs for show_detailed_exceptions?
2019-08-26 11:15:25 +01:00
John Hawthorn 4a2746db1c
Merge pull request #37002 from tgxworld/fix_connection_pool_repaer
Fix `ConnectionPool::Reaper` reaping parent connection pool after fork.
2019-08-24 15:20:55 -07:00