Commit Graph

74366 Commits

Author SHA1 Message Date
Jonathan Hefner
897cdc721e Fix escaping in OptimizedFileSystemResolver
`OptimizedFileSystemResolver` builds a regular expression to match view
template paths.  Prior to this patch, only file globbing special
characters were escaped when building this regular expression, leaving
other regular expression special characters unescaped.

This patch properly escapes all regular expression special characters,
and adds test coverage for paths that include these characters.

Fixes #37107.
2019-09-09 12:20:02 -05:00
Ryuta Kamizono
1074fb4ebe
Merge pull request #37115 from Shopify/intern-activejob-queue-name
Intern ActiveJob queue_name
2019-09-03 23:48:08 +09:00
Jean Boussier
e623ccf921 Intern ActiveJob queue_name
Memory profiling shows that the queue name is always duplicated

```
Retained String Report
-----------------------------------
  ...
217  "default"
200  /tmp/bundle/ruby/2.6.0/bundler/gems/rails-59e746d4d07b/activejob/lib/active_job/queue_name.rb:52
```
2019-09-03 16:16:39 +02:00
Akira Matsuda
5665fb5f6e send with **options only when options is not empty
or this causes "ArgumentError: wrong number of arguments (given 1, expected 0)" in some methods
2019-09-03 20:59:14 +09:00
Akira Matsuda
b7e591a55f These RequestHelpers' methods take keyword arguments 2019-09-03 18:55:50 +09:00
Akira Matsuda
614b552a0a RequestEncoder.register_encoder takes keyworded arguments 2019-09-03 18:14:39 +09:00
Akira Matsuda
08ee9d1490 Passing in a Hash instance as non-kwargs parameters has to be braced in Ruby 3.0 syntax 2019-09-03 18:12:23 +09:00
Akira Matsuda
b5704f3b38 Passing in a Hash instance as kwargs parameters requires the "double splat" prefix 2019-09-03 18:10:18 +09:00
Akira Matsuda
3cfd6d1d44 Introduce keyword arguments for some AS::Cache methods
since RedisCacheStore#write_entry takes kwargs, we needed to kwargsify all these methods
in order to eliminate Ruby 2.7 warnings.

It's a little bit bigger patch than I expected, but it doesn't warn on Ruby 3,
and it doesn't introduce any incompatibility on loder rubies, so it may not be a bad thing anyway.
2019-09-03 17:48:40 +09:00
Akira Matsuda
81230c610f Unify the API with Messages::Rotator::Verifier#verify that takes kwargs 2019-09-03 17:48:40 +09:00
Akira Matsuda
575d4d1348 subscribe block doesn't take keyword arguments 2019-09-03 17:48:40 +09:00
Akira Matsuda
1e4e0935bc :number is not a keyword argument 2019-09-03 17:48:40 +09:00
Akira Matsuda
e60c1bfc7f I18n.translate takes kwargs options 2019-09-03 17:48:40 +09:00
Akira Matsuda
87b428c8e0 Passing in a Hash instance as kwargs parameters requires the "double splat" prefix
See https://bugs.ruby-lang.org/issues/14183 for details
2019-09-03 17:48:34 +09:00
Akira Matsuda
e69b5f500b Passing in a Hash instance as non-kwargs parameters has to be braced in Ruby 3.0 syntax
See https://bugs.ruby-lang.org/issues/14183 for details
2019-09-03 17:38:55 +09:00
Ryuta Kamizono
d94263f3e7
Merge pull request #37109 from giraffate/fix_href_to_replace_http_with_https
Fix href to replace http with https in the `Yay! You’re on Rails!` page
2019-09-03 10:44:26 +09:00
Akira Matsuda
aa756a4c44 Prefer normal method call over method_missing 2019-09-03 10:26:15 +09:00
Takayuki Nakata
aeb59dd9d3 Fix href to replace http with https in the Yay! You’re on Rails! page 2019-09-03 09:43:29 +09:00
y-yagi
ef4bf83a1b
Merge pull request #37102 from y-yagi/fixes_37011
Correctly classify the files and directories that pass to watcher
2019-09-03 07:57:41 +09:00
y-yagi
54ce780477
Merge pull request #37083 from swrobel/patch-5
Add title tag to mailer previews
2019-09-03 07:29:40 +09:00
Stefan Wrobel
b9689aefe5 Add title tag to mailer previews 2019-09-02 14:44:46 -07:00
yuuji.yaginuma
81befcf267 Correctly classify the files and directories that pass to watcher
Currently, autoload paths pass to the watcher as directories. If using evented
watcher, this possibly pass as it is to `Listen`.
But autoload paths include files and `Listen` raise an error when was passed
file. So, it is necessary to classify files and directories correctly.

Fixes #37011.
2019-09-02 11:22:39 +09:00
Ryuta Kamizono
d05f1f036f Merge pull request #37103 from giraffate/add_tests_for_no_or_blank_like_arguments_to_query_methods
Add tests for no or blank like arguments to query methods
2019-09-02 10:49:58 +09:00
Ryuta Kamizono
ffbfa3dc99
Merge pull request #37104 from giraffate/fix_an_error_message_to_replace_http_with_https_in_a_reference_URL
Fix an error message to replace http with https in a reference URL
2019-09-02 10:36:13 +09:00
Takayuki Nakata
1cc1c085e8 Fix an error message to replace http with https in a reference URL 2019-09-02 10:02:29 +09:00
Takayuki Nakata
2f308e7071 Add tests for no or blank like arguments to query methods
The methods with tests added here is for the query methods that uses
`check_if_method_has_arguments!` in `ActiveRecord::QueryMethods`.
However, some of these query methods had no tests.
2019-09-02 09:39:41 +09:00
Ryuta Kamizono
f5943abcd0
Merge pull request #37101 from eugeneius/active_job_sidekiq_integration_tests
Fix Active Job Sidekiq integration tests
2019-09-02 07:01:44 +09:00
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