Commit Graph

75702 Commits

Author SHA1 Message Date
Ryuta Kamizono
950b39482d Fix keyword arguments warnings in Active Job
Related #38053, #38187, #38105.

This is a reattempt to fix keyword arguments warnings in Active Job.

Now Ruby (master) has `Hash.ruby2_keywords_hash{?,}` and that will be
backported to 2.7.1.

https://github.com/ruby/ruby/pull/2818
https://bugs.ruby-lang.org/issues/16486

I've emulated that for 2.7.0 and older versions.
2020-01-19 12:09:54 +09:00
Eileen M. Uchitelle
d72f940d16
Merge pull request #38256 from eileencodes/deprecate-default-hash
Deprecate and replace `#default_hash` and `#[]`
2020-01-17 16:56:44 -05:00
Zhang Kang
96b74fe433 Introduce ActionCable::Channel#stop_stream_from/for to unsubscribe specific streams (#37171)
* Like `ActionCable::Channel#stop_all_streams`, but for specific streams
2020-01-17 13:39:06 -08:00
eileencodes
2a53fe638d
Deprecate and replace #default_hash and #[]
Database configurations are now objects almost everywhere, so we don't
need to fake access to a hash with `#default_hash` or it's alias `#[]`.
Applications should `configs_for` and pass `env_name` and `spec_name` to
get the database config object. If you're looking for the default for
the test environment you can pass `configs_for(env_name: "test", spec_name:
"primary")`. Change test to developement to get the dev config, etc.

`#default_hash` and `#[]` will be removed in 6.2.

Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
2020-01-17 16:08:12 -05:00
John Hawthorn
dd2798ca65
Merge pull request #38254 from jhawthorn/filename_max_size
Reduce FILENAME_MAX_SIZE to accomodate large PIDs
2020-01-17 11:42:30 -08:00
John Hawthorn
a98f330fb1 Reduce FILENAME_MAX_SIZE to accomodate large PIDs
The max size here is designed around Ruby's Dir::Tmpname.create which
creates temporary filenames in the format

    $TIMESTAMP-$PID-$RANDOM

I believe the previous value of this field was based on the assumption
that PIDs are 1-65535, which isn't necessarily the case on 64 bit Linux
systems, which can be up to 2**22.

    $ uname -a
    Linux zergling 5.4.11-arch1-1 #1 SMP PREEMPT Sun, 12 Jan 2020 12:15:27 +0000 x86_64 GNU/Linux
    $ cat /proc/sys/kernel/pid_max
    4194304

I've chosen a new value based on what I believe the largest possible
tempname is:

    255 - "20200117-4194304-#{0x100000000.to_s(36)}.lock".length #=> 226
2020-01-17 11:23:15 -08:00
Gannon McGibbon
7da834fdda
Merge pull request #38246 from gmcgibbon/mark_js_guide_as_wip
Mark working_with_javascript_in_rails as WIP
2020-01-16 19:19:12 -05:00
Gannon McGibbon
0c88ac6a8d Mark working_with_javascript_in_rails as WIP
Mark as WIP to indicate it is outdated and currently being worked on.
2020-01-16 15:18:54 -05:00
Carlos Antonio da Silva
776d4bd633 Fix typo [ci skip] 2020-01-16 17:15:47 -03:00
Gannon McGibbon
ed81601723 Only enqueue analysis jobs when blob is analyzable 2020-01-16 14:14:28 -05:00
Ryuta Kamizono
5d2789b11b Avoid extra Array allocation for build_tag_values 2020-01-16 08:25:38 +09:00
Ryuta Kamizono
c699cbc4fe Remove SQLite version support caveats [ci skip]
Follow up #36255.
2020-01-16 07:14:54 +09:00
Ryuta Kamizono
6607618afd If dependent: nil is valid for has_many, it also be valid for has_one
Follow up #35504.

[ci skip]
2020-01-16 07:05:20 +09:00
Ryuta Kamizono
c900cdfdc3 Avoid extra Array allocation 2020-01-16 07:00:51 +09:00
Ryuta Kamizono
ac206e6dff Prefer match? over match 2020-01-16 06:53:53 +09:00
Eileen M. Uchitelle
464a86f90b
Merge pull request #37940 from cpruitt/activesupport-disallowed-deprecations
Introduce ActiveSupport Disallowed Deprecations
2020-01-15 13:58:04 -05:00
Cliff Pruitt
10754f79f3 Allow ActiveSupport deprecation warnings to be configured as disallowed
This allows deprecation messages to be matched by substring, symbol (treated as
substring), or regular expression. If a warning is matched, the behaviors
configured for disallowed deprecations will be used. The default behavior for
disallowed deprecation warnings is `:raise`.

Also adds `ActiveSupport::Deprecation.allow` for thread-local, block level ignoring of deprecation warnings which would otherwise be disallowed by ActiveSupport::Deprecation.disallowed_warnings.
2020-01-15 13:28:11 -05:00
Ryuta Kamizono
36e6a51662 Fix CI failures due to MySQL 8.0.19 no longer output integer display width unless ZEROFILL is also used
https://buildkite.com/rails/rails/builds/66475#7a6c54bc-4ed3-4676-b196-4fee031f43bf

Fixes #38226.
2020-01-15 21:40:10 +09:00
Ryuta Kamizono
1d6402042d
Merge pull request #38240 from ianfleeton/discourage-octals-in-times
Don't encourage using octals for dates and times
2020-01-15 20:37:24 +09:00
Ian Fleeton
684ae07e2f Don't encourage using octals for dates and times
This could result in confusing errors or inconsistency for 08 and 09
2020-01-15 10:57:38 +00:00
Richard Schneeman
bdc7ebc6d2
Merge pull request #38238 from douglara/fix-typos
fix typos
2020-01-14 22:10:36 -06:00
Douglas Lara
10803d6985 fix typos 2020-01-15 00:11:40 -03:00
Aaron Patterson
ace7060685
Merge pull request #38236 from HParker/fix-helper_method-kwargs
prevent helper_method from calling to_hash
2020-01-14 16:00:44 -08:00
Adam Hess
85f95b2f58 prevent helper_method from calling to_hash
`helper_method` was taking `**kwargs` on all definitions by default.
ruby will assume that this means you want keyword args and call
`to_hash` on what you pass if the object responds to `to_hash`. Instead
we should only take keyword args if the helper method defined intends
to pass keyword args.

This also fixes a warning when you pass a hash to your helper method,

```
warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
```

Also, this would be a good candidate for using `...`, but since `send`
requires the method as the first argument, we can't use it here.
2020-01-14 15:33:33 -08:00
Carlos Antonio da Silva
10a37f33b7 Fix my own typo now, ops! [ci skip] 2020-01-14 09:27:28 -03:00
Carlos Antonio da Silva
d277e871e9 Fix typo and make indent/examples consistent on docs for where.missing
[ci skip]
2020-01-14 09:19:29 -03:00
Ryuta Kamizono
00c010c5a0
Merge pull request #38231 from sikachu/sikachu/remove-empty-line-remove-column
Remove an empty line from generated migration
2020-01-14 17:39:40 +09:00
Prem Sichanugrist
0ac7b8c843 Remove an empty line from generated migration
Currently, if you run `rails g migration remove_column_from_models`,
there is an empty line before `remove_column` line because we forgot to
use `-%>` in the template:

    $ bin/rails g migration remove_title_from_posts title:string
          invoke  active_record
          create    db/migrate/20200114061235_remove_title_from_posts.rb

    $ cat db/migrate/20200114061235_remove_title_from_posts.rb
    class RemoveTitleFromPosts < ActiveRecord::Migration[6.1]
      def change

        remove_column :posts, :title, :string
      end
    end

This commit adds the missing `-` in front of `-%>` to make it removes
the empty line.
2020-01-14 15:22:45 +09:00
John Hawthorn
5371d5dcf2
Merge pull request #38230 from jhawthorn/benchmark_ms_block
Pass Benchmark.ms block through to realtime
2020-01-13 16:59:15 -08:00
Ryuta Kamizono
0399be7076 rexml has been bundled gems in Ruby 2.8 (3.0)
https://bugs.ruby-lang.org/issues/16485
https://github.com/ruby/ruby/pull/2832
2020-01-14 09:35:37 +09:00
John Hawthorn
a8ab5ff499 Pass Benchmark.ms block through to realtime
Avoids pushing an extra stack frame.
2020-01-13 16:26:53 -08:00
Ryuta Kamizono
164069fd2d Fix random CI failure due to non-deterministic sorting order
https://buildkite.com/rails/rails/builds/66424#a1fdb92a-a9a0-4ff2-afc8-a59410cd4fdf/1016-1027
2020-01-14 08:44:05 +09:00
John Hawthorn
f891a8d7d4
Merge pull request #38227 from jhawthorn/fix_for_mimitest_5_14
Fix CI error with minitest 5.14
2020-01-13 12:19:22 -08:00
John Hawthorn
268a099b1b Fix CI error with minitest 5.14
Follow up to 2bf1c17c20b3a2d053cba8db74b91acacaa62308, which still left
this one failure. Minitest 5.14 uses error instead of exception, so
exception had been changed to just be the same UnexpectedError instance
and losing us the actual error message.

This also switches to initializing a new UnexpectedError instance
because previously, for reasons I can't quite figure out, reusing the
same instance would still give us a DRbConnError.
2020-01-13 11:28:50 -08:00
Gannon McGibbon
8c71793b3b
Merge pull request #38212 from gmcgibbon/numericality_validation_with_scale
Add scale support to ActiveRecord::Validations::NumericalityValidator
2020-01-13 12:32:32 -05:00
Eileen M. Uchitelle
cdc3dce724
Merge pull request #38206 from tsuka/fix-38178
Fix NoMethodError on ActiveSupport::Cache::RedisCacheStore#clear with…
2020-01-13 11:56:01 -05:00
Ryuta Kamizono
f971ce5daf
Merge pull request #38128 from kddeisz/forward-kwargs
Remove Ruby 2.7 warning on arg forwarding
2020-01-14 01:29:45 +09:00
Kevin Deisz
e4c035a8fb
Fix warning on arg forwarding in integration tests
Kwargs need to be forwarded for this method_missing to avoid warnings in Ruby 2.7.
2020-01-13 11:19:31 -05:00
Gannon McGibbon
f72f743dc3 Add scale support to ActiveRecord::Validations::NumericalityValidator 2020-01-13 11:00:22 -05:00
Ryuta Kamizono
4628518382 rack 2.1.1 has released
https://github.com/rack/rack/compare/2.1.0...2.1.1
2020-01-12 19:54:25 +09:00
Ryuta Kamizono
2bf1c17c20 Fix CI failure due to renamed #exception= to #error= in minitest 5.14.0
5802aa0828
https://github.com/seattlerb/minitest/pull/809#discussion_r332399750

To support both 5.13.0 and 5.14.0, use `#initialize` instead.
2020-01-12 19:16:08 +09:00
Ryuta Kamizono
ee0d2158c9 Update image_processing to avoid Ruby 2.7 warnings
https://github.com/janko/image_processing/pull/63
2020-01-12 15:18:59 +09:00
Ryuta Kamizono
cba70a86da
Merge pull request #38216 from kamipo/fix_failure_for_rack-2.1.0
rack 2.1.0 changed expires date format from rfc2822 to httpdate
2020-01-12 06:01:39 +09:00
Kasper Timm Hansen
b36e4aa93a
Merge pull request #38217 from eugeneius/to_json_reduce_allocations
Reduce number of created objects in Hash#to_json
2020-01-11 21:50:17 +01:00
Kasper Timm Hansen
6368e8082f
Merge pull request #34727 from higher-pixels/add_missing_to_where_chain
Finding Orphan Records
2020-01-11 21:37:36 +01:00
Tom Rossi
9bfe89e68e Introducing the where.missing query method. 2020-01-11 09:14:25 -05:00
Eugene Kenny
144df5b104 Reduce number of created objects in Hash#to_json
Followup to 9256ae8a389fd40f9e4f152737de0fb2c6059daf.

Since the result of `as_json` is typically encoded with `to_json`, this
patch should save the same number of allocations as the previous one.
2020-01-11 11:03:20 +00:00
Ryuta Kamizono
a6a4222384 rack 2.1.0 changed expires date format from rfc2822 to httpdate
See https://github.com/rack/rack/pull/1144.
2020-01-11 15:09:50 +09:00
Aaron Patterson
c2d7bdc6cc
Merge pull request #38211 from rails/do-not-reparse-path-info
Do not re-parse PATH_INFO when validating authenticity token
2020-01-10 12:38:01 -08:00
Rafael França
dec4dca0dc
Merge pull request #38203 from jonathanhefner/plugin-put-dev-deps-in-gemfile
Put dev dependencies in generated plugin Gemfile
2020-01-10 14:51:19 -05:00