Commit Graph

73333 Commits

Author SHA1 Message Date
L.Fexon 858c63a0a4 fixed usage of Parameters when a non-numeric key exists
test for non-numeric key in nested attributes

test: extra blank line between tests removed

test for non-numeric key fixed (by Daniel)

Update according to feedback
2019-05-13 15:03:27 +08:00
Gannon McGibbon e84ee74854 Merge branch 'migration-timestamp-fix'
Closes #28707.
2019-05-10 16:45:46 -04:00
Eileen M. Uchitelle 36d145ca45
Merge pull request #36184 from vishaltelangre/as-monotonic-timed-subscriber
Introduce ActiveSupport::Notifications.monotonic_subscribe
2019-05-10 15:16:49 -04:00
Vishal Telangre 93b652affb
Introduce 'ActiveSupport::Notifications::Fanout::Subscribers::MonotonicTimed' and 'ActiveSupport::Notifications::monotonic_subscribe'
Also, change the signature of ‘ActiveSupport::Notifications::Fanout#subscribe’ to accept optional ‘monotonic’ boolean argument. Then initialize either a ‘Timed’ or ‘MonotonicTimed’ subscriber based on the value of ‘monotonic’ parameter.

Introduce ‘ActiveSupport::Notifications::monotonic_subscribe’ method

Also, provision ‘ActiveSupport::Notifications::subscribed’ to optionally accept ‘monotonic’ boolean argument.

Update documentation for ActiveSupport::Notifications

Add tests

Update guides documentation under the 'Active Support Instrumentation' chapter

Incorporate feedback: use optional keyword argument to specify optional 'monotonic' option to 'subscribed' method

Fix a typo
2019-05-10 20:16:17 +05:30
George Claghorn 6394f9da69
Merge pull request #36181 from jamesdabbs/jcd/action-mailbox-for
Expose `mailbox_for` method
2019-05-09 23:02:21 -05:00
Xavier Noria 3363a3c2a5 fixes configuration examples [ci skip] 2019-05-09 22:52:04 +02:00
James Dabbs 937f7d582e Add CHANGELOG entry 2019-05-09 13:34:21 -07:00
Yuji Yaginuma 669b52d296
Merge pull request #36225 from deivid-rodriguez/workaround_sass_rails_requirement
Use a better requirement for sass-rails 6 prereleases
2019-05-09 17:33:55 +09:00
Ryuta Kamizono 7aac931dfd
Merge pull request #36223 from sharang-d/revert-36214
Fix indentation of the config.eager_load nil warning
2019-05-09 16:59:00 +09:00
Sharang Dashputre 3d5cf0c595 Fix indentation of the config.eager_load nil warning 2019-05-09 13:17:04 +05:30
David Rodríguez 786bdc4c11
Use a better requirement for sass-rails 6 prereleases
This is the behavior I naively expect for the operator when used with a
single digit, but it's definitely an edge case for it, and it doesn't
seem to work as expected for including prereleases.

Using >= works fine and make the intention more clear anyways.
2019-05-09 09:40:30 +02:00
Ryuta Kamizono 7d4df79ac7
Merge pull request #36216 from utilum/update_resque_scheduler
bundle update resque-scheduler to latest version
2019-05-09 11:38:16 +09:00
Rafael França dd868aa0c8
Merge pull request #36221 from jhawthorn/middleware_instrumentation
Only build middleware proxy when instrumentating
2019-05-08 17:00:35 -04:00
John Hawthorn 6f549ce53f Only build middleware proxy when instrumentating
The instrumentation proxy adds three stack frames per-middleware, even
when nothing is listening.

This commit, when the middleware stack is built, only adds
instrumentation when the `process_middleware.action_dispatch` event has
already been subscribed to.

The advantage to this is that we don't have any extra stack frames in
apps which don't need middleware instrumentation.

The disadvantage is that the subscriptions need to be in place when the
middleware stack is built (during app boot). I think this is likely okay
because temporary AS::Notifications subscriptions are strongly
discouraged.
2019-05-08 13:30:41 -07:00
Xavier Noria 52125dc0f8 documents restriction for explicit namespaces [ci skip] 2019-05-08 21:07:13 +02:00
Xavier Noria 44795cded6 documents how to use the classic autoloader in Rails 6 [ci skip] 2019-05-08 20:51:07 +02:00
Rafael França a6634ed0f2
Merge pull request #36214 from abhaynikam/36211-fix-indentation
Fix indentation for config.eager_load nil warning message
2019-05-08 14:26:48 -04:00
Vipul A M 75c13b5d89
Merge pull request #36215 from rmacklin/update-testing-guide
Update testing guide to reflect changes from #36047 [ci skip]
2019-05-08 12:29:36 -04:00
utilum 6dd484deef bundle update resque-scheduler to latest version
Resque 2.0 includes grammar fixes for warnings tickled by our tests. Updating resque-scheduler also requires and updates resque to version 2.0.

```
$ ruby -v
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux]
```
2019-05-08 18:05:44 +02:00
Richard Macklin 8783330034 Update testing guide to reflect changes from #36047
In #36047 we moved `take_failed_screenshot` from an `after_teardown`
hook to a `before_teardown` hook. However, I didn't realize the Testing
rails guide was explicitly mentioning that it happened inside
`after_teardown`. So this updates the docs to be consistent with that
change.

[ci skip]
2019-05-08 08:38:42 -07:00
Abhay Nikam dd643f4893 Fix indentation for config.eager_load nil warning message 2019-05-08 20:57:16 +05:30
Ryuta Kamizono 28aca474d4 Auto-correct `Style/RedundantBegin` offence
This offenced code is introduced from forward ported #36196, since looks
like 6-0-stable branch isn't checked by CodeClimate.
2019-05-08 19:34:31 +09:00
Ryuta Kamizono 378dd7a4a8 Fix broken markup in CHANGELOG [ci skip]
65bdd6ad08/activesupport/CHANGELOG.md
2019-05-08 19:22:37 +09:00
Ryuta Kamizono 8024179d60 Remove forward ported CHANGELOG [ci skip] 2019-05-08 19:19:08 +09:00
Xavier Noria 65bdd6ad08 documents autoloading in the upgrading guide [ci skip] 2019-05-08 10:09:15 +02:00
Eileen M. Uchitelle d155f61b64 Merge pull request #36196 from st0012/fix-29947
Hide malformed parameters from error page

Accidentally merged this to 6-0-stable so forward porting it to master
here instead.
2019-05-07 15:14:14 -04:00
Ryuta Kamizono 68dc8c4500
Merge pull request #36203 from st0012/fix-command-in-contributing-guide
Update directory name in example commands [ci skip]
2019-05-08 01:54:09 +09:00
st0012 23e6ad547c Update directory name in sample commands 2019-05-08 00:25:23 +08:00
Akira Matsuda 00654b5ddd Typo in the release note
[ci skip]
2019-05-08 00:53:16 +09:00
Ryuta Kamizono f10ad55ac4
Merge pull request #36202 from yahonda/log_transaction
Remove ignored_sql from SQLCounter by adding "TRANSACTION" to log name
2019-05-08 00:46:34 +09:00
Yasuo Honda 6a32e8aa72 Remove ignored_sql from SQLCounter by adding "TRANSACTION" to log name
This commit adds "TRANSACTION" to savepoint and commit, rollback statements
because none of savepoint statements were removed by #36153 since they are not "SCHEMA" statements.

Although, only savepoint statements can be labeled as "TRANSACTION"
I think all of transaction related method should add this label.

Follow up #36153
2019-05-08 00:21:31 +09:00
Vipul A M 4511d4bf7c
Merge pull request #36201 from soartec-lab/fix_typo_dot_position
Fixed typo of dot position [skip ci]
2019-05-07 09:41:32 -04:00
soartec-lab 1901c181d6 Fixed typo of dot position [skip ci] 2019-05-07 22:30:37 +09:00
Akira Matsuda cecbc2340a Properly give defaults for DatabaseSelector options
The initializer receives `nil` for these options when no cofigurations were given:
https://github.com/rails/rails/blob/v6.0.0.rc1/activerecord/lib/active_record/railtie.rb#L91-L97
2019-05-07 08:46:13 +09:00
Ryuta Kamizono 01f8abd7b2
Merge pull request #36190 from kamipo/should_attempt_tx_callbacks_to_all_records
Should attempt `committed!`/`rolledback!` to all enrolled records in the transaction
2019-05-07 02:43:15 +09:00
Ryuta Kamizono f0e2582aa0
Merge pull request #36191 from st0012/remove-useless-method
Remove unnecessary find_partial method
2019-05-07 02:41:57 +09:00
st0012 405b4c7f1e Remove useless find_partial method 2019-05-07 01:21:07 +08:00
Ryuta Kamizono 718a32ca74 Should attempt `committed!`/`rolledback!` to all enrolled records in the transaction
Currently, `committed!`/`rolledback!` will only be attempted for the
first enrolled record in the transaction, that will cause some
problematic behaviors.

The first one problem, `clear_transaction_record_state` won't be called
even if the transaction is finalized except the first enrolled record.
This means that de-duplicated records in the transaction won't refer
latest state (e.g. won't happen rolling back record state).

The second one problem, the enrolled order is not always the same as the
order in which the actions actually happened, the first enrolled record
may succeed no actions (e.g. `destroy` has already succeeded on another
record during `before_destroy`), it will lose to fire any transactional
callbacks.

To avoid both problems, we should attempt `committed!`/`rolledback!` to
all enrolled records in the transaction.
2019-05-07 02:19:57 +09:00
Ryuta Kamizono 020856c328 Remove useless `GC.start` in `test/template/render_test.rb`
The `GC.start` was added at b29e893, but the finalizer has been removed
at 7d0ce78 in #35036.
2019-05-06 23:30:07 +09:00
Ryuta Kamizono f0f7d342ff
Merge pull request #36189 from st0012/fix-36154
Clear Resolvers' cache after RenderTestCases tests
2019-05-06 23:23:56 +09:00
st0012 34a33f8b0c Clear Resolvers' cache after running RenderTestCases' test cases
The templates rendered in RenderTestCases tests will be cached by the
resolvers unexpectedly. And this will break other tests when executed in
certain order. (See https://github.com/rails/rails/issues/36154 for more
detail)

So to fix this issue, we just need to clear the caches on all resolvers.
2019-05-06 22:08:48 +08:00
James Dabbs 9ce8156c93 Delegate to the correct method in `ActionMailbox.mailbox_for` 2019-05-05 12:09:32 -07:00
James Dabbs 80af2c5831 Rename variable to represent type
per comments from CR
2019-05-05 10:29:31 -07:00
yuuji.yaginuma 85a8bc644b Make generated test work even when using virtual attributes
The virtual attributes(`attachment` and `rich_text`) can't set value
with `fill_in`. So avoid using it. Once #35885 is merged, will be
modified to use it.

Also, add checking attachment attached or not for avoiding
`DelegationError` when attachment didn't attach.
2019-05-05 09:55:37 +09:00
James Dabbs 9f96d094a3 Expose `mailbox_for` method
Currently, the only exposed entry point into the ApplicationMailbox's configured
routing system is to call `route`, which performs a lot of work to fully
`process` inbound email. It'd be nice to have a way (e.g. in test) of checking
which mailbox an email would route to without necessarily processing it yet.
2019-05-04 10:53:08 -07:00
yuuji.yaginuma ac1ba44f8d Fix test case name to fit file name
This fixes the following warnings.

```
/rails/activemodel/test/cases/nested_error_test.rb:9: warning: method redefined; discarding old test_initialize
/rails/activemodel/test/cases/error_test.rb:29: warning: previous definition of test_initialize was here
```
2019-05-04 17:49:25 +09:00
Ryuta Kamizono 9b680e52f1
Merge pull request #36172 from tgxworld/recover_pluck_perf
Recover perf for `pluck` by reverting 9c9c950d02af83742a5f76302d0faa9…
2019-05-04 01:19:13 +09:00
Guo Xiang Tan 25f1e0e3ea Recover perf for `pluck` by reverting 9c9c950d02.
This reverts commit 9c9c950d02.
2019-05-03 22:36:23 +08:00
Ryuta Kamizono 9b0e632def
Merge pull request #36168 from yahonda/remove_redundant_test_too_many_binds_testcase
Remove redundant `test_too_many_binds`
2019-05-03 09:43:04 +09:00
Yasuo Honda 36483cdb48 Remove redundant `test_too_many_binds`
with `ActiveRecord::BindParameterTest#test_too_many_binds`

sqlite adapter has its own `bind_params_length`, `ActiveRecord::BindParameterTest#test_too_many_binds` respects it.

* Modified `ActiveRecord::BindParameterTest#test_too_many_binds` to show `bind_params_length` value

```
$ git diff
diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb
index 85685d1d00..83cd07f1d7 100644
--- a/activerecord/test/cases/bind_parameter_test.rb
+++ b/activerecord/test/cases/bind_parameter_test.rb
@@ -108,6 +108,7 @@ def test_statement_cache_with_sql_string_literal

       def test_too_many_binds
         bind_params_length = @connection.send(:bind_params_length)
+        p bind_params_length

         topics = Topic.where(id: (1 .. bind_params_length).to_a << 2**63)
         assert_equal Topic.count, topics.count
$
```

* Executed modified `ActiveRecord::BindParameterTest#test_too_many_binds`

```
$ bin/test test/cases/bind_parameter_test.rb -n test_too_many_binds
Using sqlite3
Run options: -n test_too_many_binds --seed 47321

999
.

Finished in 0.075249s, 13.2892 runs/s, 26.5784 assertions/s.
1 runs, 2 assertions, 0 failures, 0 errors, 0 skips
$
```
2019-05-03 00:21:00 +00:00