Commit Graph

74706 Commits

Author SHA1 Message Date
Ryuta Kamizono
ae5df8b2cf
Merge pull request #37341 from abhaynikam/remove-duplicate-word-in-active-storage-guide
Removed repeated word 'done' from Active Storage guide [ci skip]
2019-10-02 16:13:46 +09:00
Abhay Nikam
40e12c2ff9 Removed repeated word 'done' from Active Storage guide [ci skip] 2019-10-02 12:32:24 +05:30
Ryuta Kamizono
d204e17820
Merge pull request #37339 from giraffate/remove_unused_require
Remove unused require
2019-10-02 16:00:41 +09:00
प्रथमेश Sonpatki
3082a409d8
Merge pull request #37340 from abhaynikam/fix-individual-attachments-service-test-typo
Fixed typo in attachment service test description. custom_ ervice -> custom service [ci skip]
2019-10-02 12:24:41 +05:30
Abhay Nikam
1a84adac6d Fixed typo in attachment service test description. custom_ ervice -> custom service [ci skip] 2019-10-02 12:19:23 +05:30
Takayuki Nakata
7418469f39 Remove unused require
`except` was removed at b77dd218ce
2019-10-02 13:37:05 +09:00
Carlos Antonio da Silva
c3103383d3 Update Gemfile.lock with newly added activesupport dependencies
Reference: 3b23c644971fc5805505748e78c3230d25ef7618
2019-10-01 23:24:51 -03:00
Carlos Antonio da Silva
c14edd700b Reverse assertion arguments: expected, actual 2019-10-01 23:20:50 -03:00
Carlos Antonio da Silva
e5e4e11989 Require minitest/mock since we rely on stub in this test file
Otherwise running the test file directly like this:

    $ be ruby -w -Ilib:test test/models/variant_test.rb

Fails with:

    Error:
    ActiveStorage::VariantTest#test_passes_content_type_on_upload:
    NoMethodError: undefined method `stub' for #<ActiveStorage::Service::DiskService:0x00007fd53ba89ef0>
        test/models/variant_test.rb:207:in `block in <class:VariantTest>'
2019-10-01 23:17:41 -03:00
Kyle Ribordy
698e9ce0ff Set Content-Type on variant uploads 2019-10-01 20:51:13 -04:00
Gannon McGibbon
60d3c14a73 Fix GCS and Azure failing tests on Active Storage 2019-10-01 17:44:36 -04:00
Gannon McGibbon
5d81880670 Fix failing tests on Active Storage 2019-10-01 17:03:20 -04:00
Gannon McGibbon
84d236d0a9
Merge pull request #34935 from DmitryTsepelev/configure-store-per-attachment
Allow configure services for individual attachments
2019-10-01 14:52:23 -04:00
DmitryTsepelev
e7f798c3f5 Allow configure services for individual attachments 2019-10-01 21:24:05 +03:00
meganemura
3b23c64497 List activesupport as a direct dependency 2019-10-01 13:28:52 -04:00
Brandon Medenwald
6229c2b223 Redis cache store: fail gracefully when max clients reached 2019-10-01 13:24:22 -04:00
Kasper Timm Hansen
4c785f7360
Merge pull request #37112 from qnighy/action-dispatch-configure-later
Delay ActionDispatch::Response configuration to load-time
2019-10-01 15:56:33 +02:00
Masaki Hara
89f5789aad Delay ActionDispatch::Response configuration to load-time
It fixes the problem in propagating return_only_media_type_on_content_type
and fixes the corresponding test being ineffective.

The mentioned test addes the following line:
...config.action_dispatch.return_only_media_type_on_content_type = true
to the config and checks if it takes effect. However, in this scenario,
the value is already true before this line.
Moreover, the users are supposed to flip this from true to false in real
situations.

This commit flips the config in the test, making it to fail as
expected. The next commit will fix the failure.

In order for return_only_media_type_on_content_type to appropriately
take effect on ActionDispatch::Response, we want to know when
ActionDispatch::Response is loaded.
As load hooks for ActionDispatch would be too broad, the appropriate
registry is for ActionDispatch::Response itself.

Looking into other examples, a hook name is a full class name in
snake case with `_base` suffix omitted, if any. Therefore, in this case,
:action_dispatch_response seems appropriate.
2019-10-01 17:42:05 +09:00
Ryuta Kamizono
eaff375de4
Merge pull request #37328 from eugeneius/sql_active_record_query_cache
Include connection in cached query notifications
2019-10-01 17:20:52 +09:00
Rafael Mendonça França
57ae917e9d Remove any precision problem by comparing the float values
Rational values are move precise than float values so when comparing
rationals values may be off by a few units that are hard to assert
equality. Let's make sure we are comparing the float value with float
values.
2019-09-30 23:20:22 -04:00
Carlos Antonio da Silva
8fdbc2ae22 Use assert_queries since we are only checking for the count 2019-09-30 22:38:00 -03:00
John Hawthorn
f4d2eadaaa
Merge pull request #37266 from jhawthorn/avoid_query_on_empty_in
Avoid making query when using `where(attr: [])`
2019-09-30 16:41:40 -07:00
John Hawthorn
a8b16c8a5b Avoid making query when using where(attr: []) 2019-09-30 16:37:07 -07:00
Eugene Kenny
cb7c92203b Include connection in cached query notifications
Since 6d1c9a9b23579d13b7cbdd3217ed2cfcc300e06e the `sql.active_record`
notification includes the connection that executed the query, but only
when the result comes from the database, not the query cache.
2019-10-01 00:35:32 +01:00
John Hawthorn
4f5c63296e
Merge pull request #37330 from eugeneius/active_storage_key_length
Always use 28 characters for Active Storage keys
2019-09-30 16:34:37 -07:00
Eugene Kenny
47e563781c Always use 28 characters for Active Storage keys
Active Storage keys are generated in two ways: in the `before_create`
callback added by `has_secure_token`, or by calling `key` before the
blob is saved. a273da7619ac6a2b2f98532a5610238c68ad219b broke the
former code path, and the latter was previously untested.
2019-10-01 00:24:41 +01:00
John Hawthorn
4484db4094 Fix fraction float assertions in time_ext_test
These failed previously because decimals floats don't make perfect
decimal numbers and Rational represents them exactly (either as decimal
or the inexact float value).

This changes the asserts to match that value.
2019-09-30 15:51:15 -07:00
Rafael Mendonça França
d96a715859 Decrease the precision of the sec_fraction in the tests
We were using picoseconds as precision but some Ruby implementations
only support up to nanoseconds. Since that much precision was not needed
to test the feature I decreased the precision.
2019-09-30 18:19:48 -04:00
Rafael França
3124007bd6
Merge pull request #37327 from Shopify/fork-tracker-fixes
Fork tracker fixes
2019-09-30 17:48:24 -04:00
Étienne Barrié
7ca163d8c3 Also override Kernel#fork 2019-09-30 17:05:37 -04:00
Étienne Barrié
f223c795e8 Keep Object#fork private 2019-09-30 17:05:37 -04:00
Rafael Mendonça França
a273da7619 Merge pull request #35915 from bernardoamc/allow-has-secure-token-length-manipulation
Allow token length configuration for has_secure_token method
2019-09-30 15:13:04 -04:00
Matthew Draper
9a62e95f4a
Merge pull request #37312 from Shopify/on-fork-callback
Introduce a callback for forked children
2019-09-30 19:55:50 +09:30
Jean Boussier
78b9580e5f Introduce a callback for forked children
We hook into Kernel#fork and Process#fork, when they are invoked
we can trigger all the registered callbacks.

There is also a `check!` method that can be called to very cheaply
detect if the process was forked.
2019-09-30 12:04:59 +02:00
George Claghorn
4dba136c83 Allow providing a custom key per blob
Closes #37315.
2019-09-29 20:07:09 -04:00
George Claghorn
0069400326 Use Module#deprecate 2019-09-29 15:52:12 -04:00
George Claghorn
8f37e2555a Avoid Element.closest() for IE 9 compatibility
Fixes #37234.
2019-09-29 09:07:11 -04:00
yuuji.yaginuma
53a1e44a55 Explicitly require active_record/migration
This test class uses `ActiveRecord::IllegalMigrationNameError`.
So without this require, tests fail randomly.
https://buildkite.com/rails/rails/builds/63965#15e634e0-49a7-4658-9076-e6663458bee5/1119-1129
2019-09-29 08:07:14 +09:00
George Claghorn
50bca958cf Correct test class name 2019-09-28 10:31:26 -04:00
George Claghorn
06f8baf73c Discard ActiveStorage::AnalyzeJobs on ActiveRecord::RecordNotFound
Fixes #37305.
2019-09-28 10:28:21 -04:00
Matthew Draper
ade48853d9
Merge pull request #36907 from wjessop/string_attribute_should_compare_with_typecast_symbol_after_update
Serialize symbols to strings in ImmutableString serialize method
2019-09-28 18:20:08 +09:30
Ryuta Kamizono
3dbe9a50d7 Using a class method is not the preferred way to accept arguments for scopes
I'm not sure why using a class method is the preferred way 10 years ago.

b4b2574...226a2a9

But at least in Rails 6.1, using a scope is the preferred way since
several scoping issues will be fixed only for scopes.

[ci skip]
2019-09-28 16:58:16 +09:00
Ryuta Kamizono
1f37f043a6 Fix index array's offset 2019-09-28 16:04:06 +09:00
Ryuta Kamizono
bc7ed042c4 Use String#+@ before mutating the result of Symbol#to_s
Follow up #37303.

https://buildkite.com/rails/rails/builds/63957#dc16cd12-10a2-435c-9b64-b8332114d92a/981-1293
2019-09-28 15:53:20 +09:00
Ryuta Kamizono
63299ce7a3 Revert register proc takes keyword arguments
Because Ruby 2.6 cannot ignore empty kwargs.

https://buildkite.com/rails/rails/builds/63958#9932c536-b1df-4d2c-bda0-c59ed0e254c1/987-995
2019-09-28 15:07:38 +09:00
Ryuta Kamizono
404e1a0acd touch_attributes_with_time takes keyword arguments 2019-09-28 14:54:29 +09:00
Ryuta Kamizono
2cf74f6b87 Fix remaining keyword arguments warnings for Active Record
Except required `ruby2_keywords` things.
2019-09-28 14:42:25 +09:00
Ryuta Kamizono
d700456cb7 create_table_definition takes keyword arguments 2019-09-28 14:25:13 +09:00
Ryuta Kamizono
e0375764b7 foreign_key takes keyword arguments 2019-09-28 14:22:47 +09:00
Ryuta Kamizono
2b2673cb1e add_reference/remove_reference takes keyword arguments 2019-09-28 14:21:35 +09:00