Commit Graph

74571 Commits

Author SHA1 Message Date
Eileen M. Uchitelle
34eda953fb
Merge pull request #37230 from eileencodes/deprecate-current_config
Deprecate `current_config` and `current_config=`
2019-09-18 16:06:37 -05:00
Ryuta Kamizono
9a7f15c905
Merge pull request #37235 from kamipo/fix_eager_load
Maintain eager loading joining order as before
2019-09-18 18:30:42 +09:00
Ryuta Kamizono
783cafee4f Maintain eager loading joining order as before
If a relation has eager_load and string joins only, string joins will be
regarded as leading joins unlike before, due to #36805.

To maintain that joining order as before, check eager loading join
first before string joins.

Fixes #37133.
2019-09-18 17:42:15 +09:00
Ryuta Kamizono
19a2d5c112
Merge pull request #37228 from eugeneius/action_dispatch_response_autoload
Allow ActionDispatch::Response to be autoloaded
2019-09-18 15:29:53 +09:00
Akira Matsuda
0fa8c0a1d9 Reduce Array allocations 2019-09-18 14:56:28 +09:00
Akira Matsuda
5c07e1a3f4 Reduce Hash allocations
Merging multiple Hashes in Ruby < 2.6 is so hard...
2019-09-18 14:37:27 +09:00
Akira Matsuda
a221ee84da String#force_encoding destructively updates the hash values 2019-09-18 14:37:27 +09:00
Akira Matsuda
2db4c0203a Reduce object allocations in Journey 2019-09-18 14:37:27 +09:00
eileencodes
696259c506 Deprecate current_config and current_config=
Uses of `current_config` and `current_config=` were removed when
implementing multiple datatabase Rails tasks. This means they are no
longer used internally. However, since it is a documented method it may
be used in gems or applications. This change deprecates these methods so
that we can remove them in 6.2.

Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
2019-09-17 20:47:49 -04:00
Vipul A M
65fd61fbf4
Merge pull request #37229 from giraffate/fix_typo_in_activestorage_readme
Fix typo in activestorage README [ci skip]
2019-09-18 05:54:42 +05:30
Takayuki Nakata
b08d428ba0 Fix typo in activestorage README [ci skip]
`a ActionDispatch::Http::UploadedFile object` ->
`an ActionDispatch::Http::UploadedFile object`
2019-09-18 09:19:22 +09:00
Eugene Kenny
aaa9b669f8 Allow ActionDispatch::Response to be autoloaded
Similar to b744372f2dfd3d86f7eb4af99b1f9049e21f3d44, this defers loading
`ActionDispatch::Response` until after initialization, which will allow
applications to boot a bit faster in development but also paves the way
for `return_only_media_type_on_content_type` to work correctly when set
from `new_framework_defaults_6_0.rb`.

Benchmark:

    $ cat test.rb
    require "bundler/setup"
    before = ObjectSpace.each_object(Module).count
    start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
    require "action_controller"
    finish = Process.clock_gettime(Process::CLOCK_MONOTONIC)
    after = ObjectSpace.each_object(Module).count
    puts "took #{finish - start} and created #{after - before} modules"

Before:

    $ ruby test.rb
    took 0.35654300000169314 and created 608 modules

After:

    $ ruby test.rb
    took 0.2770050000108313 and created 466 modules

Co-authored-by: Serena Fritsch <serena@intercom.io>
2019-09-17 23:38:01 +01:00
Eugene Kenny
2b388c9648
Merge pull request #37227 from john-denisov/patch-1
Fix typo and simplify autoload paths intro
2019-09-17 23:32:21 +01:00
Ivan Denysov
d122ae6143 Fix typo and simplify autoload paths intro
Initially I just wanted to remove _to_ from _We call autoload paths to
the list..._. But this sentence also seemed a little bit overcomplicated
😅

[ci skip]
2019-09-17 23:10:10 +01:00
George Claghorn
ccfb8ea2f2
Merge pull request #37214 from mperham/patch-1
Allow Sidekiq access to the underlying Job class
2019-09-17 14:25:05 -04:00
Eileen M. Uchitelle
84496b85cb
Merge pull request #37223 from seejohnrun/fix-current-config-bug
Fix a typo in DatabaseTasks#current_config
2019-09-17 11:15:25 -04:00
John Crepezzi
9dfdc752eb Fix a typo in DatabaseTasks#current_config
This commit fixes a method typo that was introduced in #37199, also also
adds tests for the `DatabaseTasks#current_config` method given it's
current implementation.

While I was in here, I also made it so that if `current_config` is
called with an `env` it won't try to look up the `Rails.env`
potentially resulting in an error for non-Rails application.

IMO this method should be deprecated & removed as it's no longer used in
Rails, is confusing (for example: `test_current_config_read_after_set`),
and is currently dependent on Rails if `env` isn't passed.

Co-authored-by: eileencodes <eileencodes@gmail.com>
2019-09-17 10:24:07 -04:00
Eugene Kenny
9680984cf8
Merge pull request #37221 from giraffate/fix_typo_in_actionmailbox_inboundemail_messageid
Fix typo in ActionMailbox::InboundEmail::MessageId [ci skip]
2019-09-17 11:08:25 +01:00
Takayuki Nakata
fffb2b2a11 Fix typo in ActionMailbox::InboundEmail::MessageId [ci skip]
- `a Active Storage` -> `an Active Storage`
- `which be uploaded` -> `which is uploaded`
2019-09-17 17:40:49 +09:00
Ryuta Kamizono
6e64de0f1c Silence method redefined warnings
Caused by #37120.
2019-09-17 15:53:36 +09:00
Ryuta Kamizono
fba75f0ae3 Fix typo s/higlights/highlights/ [ci skip]
Co-authored-by: Jian-Long Huang <huang@jianlong.org>
2019-09-17 15:21:25 +09:00
yuuji.yaginuma
43add6fb2c Partially revert 4a9ef5e1202cdab1882989eb561b0dc854c9891b
This broke CI. https://buildkite.com/rails/rails/builds/63708
2019-09-17 09:15:35 +09:00
Akira Matsuda
4257ea756b Prefer String#== over String#=== for clarity 2019-09-17 07:59:04 +09:00
Akira Matsuda
4a9ef5e120 Use Regext#match? where MatchData is not needed 2019-09-17 07:59:04 +09:00
Akira Matsuda
30a73035c7 No need to dup temporary strings 2019-09-17 07:59:04 +09:00
Akira Matsuda
fc2e836aed return early 2019-09-17 07:59:04 +09:00
Akira Matsuda
ec8da95447 2019-09-17 07:59:04 +09:00
Akira Matsuda
7b1fe26472 Avoid extra hash creation 2019-09-17 07:59:04 +09:00
Akira Matsuda
b577bebafe Use Path::Pattern#match? that uses Regexp#match? where MatchData is not in need 2019-09-17 07:58:59 +09:00
Akira Matsuda
bea24d4790 Reduce Array and Hash creations in Journey find_routes 2019-09-17 07:44:04 +09:00
Rafael França
a1b6c1669f
Merge pull request #37210 from jonhyman/feature-fix-36956-rebased
Fixes #36956 by dup'ing the value and entry object returned from MemoryStore.
2019-09-16 13:30:01 -04:00
Gannon McGibbon
dee5ece236
Merge pull request #37197 from unabridged/add-render-text-removal-to-5.1-upgrade-guide
[ci skip] Note removal of `render :text` & `:nothing` options from 5.1 upgrade guide
2019-09-16 13:28:25 -04:00
Grant Shangreaux
bc06641fa7 Docs: note removal of render :text option from 5.1 guide [ci skip]
This just makes it explicit that the deprecated :text option is
completely removed in Rails 5.1
2019-09-16 12:24:22 -05:00
Mike Perham
0e64348cca
Allow Sidekiq access to the underlying Job class
Currently `wrapped` is a String.  Instead pass Class so that Sidekiq can get access to the ActiveJob and its configuration without having to constantize.  I verified that `JobClass.to_s` == `"JobClass"` so serialization to JSON should not be affected.

```ruby
> JSON.dump({"wrapped" => SomeJob})
=> "{\"wrapped\":\"SomeJob\"}"
```

By having access to the ActiveJob class, Sidekiq can get access to any `sidekiq_options` which have been set on that ActiveJob type and serialize those options into Redis.

https://github.com/mperham/sidekiq/blob/master/Changes.md#60
2019-09-16 10:17:14 -07:00
Gannon McGibbon
2ebac57a74
Merge pull request #37120 from gmcgibbon/fix_has_one_reflect_check_custom_pk
Fix has_one through reflection casting check
2019-09-16 12:43:07 -04:00
Gannon McGibbon
f578503c1a
Merge pull request #37204 from gmcgibbon/remove_cap_2_example
Remove Capistrano from asset pipeline guide
2019-09-16 11:34:04 -04:00
Gannon McGibbon
730046e667 Remove Capistrano from asset pipeline guide 2019-09-16 10:53:21 -04:00
Eileen M. Uchitelle
9b6433bb82
Merge pull request #37199 from seejohnrun/reduce-surface-area-of-connection-specification
Reduce surface area of ConnectionSpecification
2019-09-16 09:35:22 -04:00
Jonathan Hyman
948c3c8bd5 Fixes #36956 by dup'ing the value and entry object returned from MemoryStore. 2019-09-16 08:37:59 -04:00
Xavier Noria
db43f33fbb renames variable in example [skip ci]
This is the conventional name for that parameter.
2019-09-16 11:35:48 +02:00
Xavier Noria
44adb830cc document how to customize inflections in autoloading [skip ci] 2019-09-16 11:03:11 +02:00
Kasper Timm Hansen
87ec20447e
Merge pull request #37206 from sj26/patch-1
Expand on helpers available in Action Mailer
2019-09-16 01:40:41 +02:00
Samuel Cochran
e50a4e57c6
Expand on helpers available in Action Mailer
Remove 'now just' — document the current state in an accessible way. Make it clear the set of helpers isn't **exactly** the same

Add references to `mailer` and `message` helpers which can be very useful.

`attachments` is already covered in "Making Inline Attachments"

Finding the mail-specific formatting heleprs are
2019-09-16 09:09:22 +10:00
Ryuta Kamizono
306e7a796d Auto-correct rubocop offences 2019-09-16 05:46:26 +09:00
Kasper Timm Hansen
b9cc147241
Merge branch 'remove-thread-local-var' 2019-09-15 17:11:17 +02:00
Sam Saffron
206345b989
Avoid expensive tracking objects for prepared statements
Per #36949 we introduce a race condition fix for #36763

This refines the fix to avoid using Concurrent::ThreadLocalVar

The implementation in the concurrent lib is rather expensive, culminating in
a finalizer per object that spins off a thread to do cleanup work.

None of this expense is needed as we can simply implement
the desired behavior using Ruby primitives. Additionally this moves to a Fiber bound implementation vs a thread bound implementation, something that is not desired for this particular usage.
2019-09-15 17:10:33 +02:00
Akira Matsuda
bf5530df68 Revert "There are some Rack middleware take keyword arguments for initializing"
This reverts commit c6ef71ccf23fcfb73c3cce82d8437a9bcb5bd07c
because this causes "wrong number of arguments (given 2, expected 1) (ArgumentError)" on Ruby 2.5
2019-09-15 09:26:01 +09:00
Akira Matsuda
c6ef71ccf2 There are some Rack middleware take keyword arguments for initializing 2019-09-15 03:09:32 +09:00
Akira Matsuda
97bc338162 define_attribute takes keyword arguments 2019-09-15 03:05:52 +09:00
Akira Matsuda
364449b252 Passing in a Hash instance as non-kwargs parameters has to be curly braced 2019-09-15 03:05:52 +09:00