Commit Graph

66846 Commits

Author SHA1 Message Date
Ryuta Kamizono 3b4b9b6cc5
Merge pull request #32485 from bogdanvlviv/fix-actionview/CHANGELOG.md
Fix `actionview/CHANGELOG.md`

[ci skip]
2018-04-07 17:44:35 +09:00
bogdanvlviv f0bde0167c
Fix `actionview/CHANGELOG.md`
- Add missing dots at the end of sentences.
- Wrap RecordTagHelper into `.
- `RecordTagHelper` => `ActionView::Helpers::RecordTagHelper`.

[ci skip]
2018-04-07 11:28:26 +03:00
Andrew White c86fa4f040
Merge pull request #32482 from yhirano55/remove_record_tag_helper
Remove RecordTagHelper
2018-04-07 08:23:40 +01:00
Andrew White ec7c89b516
Merge pull request #32350 from rails/use-current-model-for-as-url-host
Use an ActiveSupport::CurrentAttributes model to provide the host for service urls
2018-04-07 08:20:16 +01:00
Yoshiyuki Hirano 5c5ddd69b1 Remove RecordTagHelper
* Since #18411, we started to inform about extracted gem (record_tag_helper)
  to developers who use `ActionView::Helpers::RecordTagHelper` 's methods.

* Currently, it seems no problem that we don't have to support no longer.
2018-04-07 09:28:01 +09:00
yuuji.yaginuma cb2f69659e Partially revert 0bfdd1d
The `Capybara.server=` proc acceptance restored in Capyara 3.0.1.
Ref: 8f115d94e0
2018-04-07 07:18:16 +09:00
Rafael Mendonça França e6f5e75ef1
Upgrade capybara to 3.0.1 to make sure our tests are passing 2018-04-06 17:09:14 -04:00
Andrew White 9436c22e2a
Use a current model to provide the host for service urls
Trying to pass the current request down to the service so that it can
create full urls instead of paths makes the API messy so use a model
based on ActiveSupport::CurrentAttributes to provide the current host
to services that need it (primarily the disk service).
2018-04-06 20:07:52 +01:00
Rafael Mendonça França 03bd370c02
Protect all active storage controllers agains CSRF
Before it was possible to for example use the direct upload controller
without using the site.
2018-04-06 14:28:44 -04:00
Rafael Mendonça França b71b8ecc4e
Add Brewfile to make easier to install all dependencies we need to run tests
This way we don't need to remember which packages we need to install.
2018-04-06 14:21:50 -04:00
Rafael França bedb3e2250
Merge pull request #32481 from yhirano55/add_securing_rails_app_guide_link_to_credential_section
[ci skip] Add securing rails app guide link to credential section
2018-04-06 13:44:13 -04:00
Yoshiyuki Hirano b72dc84ba5 [ci skip] Add securing rails app guide link to credential section
* In 5.2 release note, added [securing rails app guide](http://edgeguides.rubyonrails.org/security.html#custom-credentials) link to [credentials section](http://edgeguides.rubyonrails.org/5_2_release_notes.html#credentials).
2018-04-07 02:35:02 +09:00
Rafael França 7fac2b496a
Merge pull request #32355 from kamipo/delegate_to_klass_in_a_scope
Bring back private class methods accessibility in named scope
2018-04-06 13:16:01 -04:00
Rafael França 00f2dbd09b
Merge pull request #32472 from Edouard-chin/ec-activesupport-teardown
`SetupAndTeardown#teardown` should call any subsequent after_teardown:
2018-04-06 13:10:08 -04:00
Javan Makhmali be811c3395
Merge pull request #32479 from kylekeesling/ie11-activestorage-direct-upload-bug-fix
Fixes a bug in IE11 that broke ActiveStorage direct uploads
2018-04-06 13:00:37 -04:00
Rafael França 162b1f5463
Merge pull request #32480 from bogdanvlviv/add-changelog-about-dig-session-23864
Add changelog entry for #32446
2018-04-06 12:43:49 -04:00
Edouard CHIN 01eddb390c Rename the class as there is already an existing class with that name 2018-04-06 12:17:58 -04:00
kylekeesling a7cdad8d26
fixes a bug in IE11 that broke direct uploads 2018-04-06 10:20:25 -04:00
bogdanvlviv 15331a2ac4
Add changelog entry for #32446
In #32446 was added method `dig` to `session`.
Improve docs of method `dig`.

[ci skip]
2018-04-06 16:50:38 +03:00
eileencodes 0a353a9786 Fix structure:dump for multiple databases
ccea4cf broke multiple database structure:dump, the current_config line
should have been deleted instead. I'm struggling to write a test for
this since the confings are passed from rake to the structure_dump
method rather than the other way around. Hoping to come up with a test
while I work on structure:load commands for multiple databases.
2018-04-06 09:36:07 -04:00
Eileen M. Uchitelle 475a2911bb
Merge pull request #32477 from bogdanvlviv/fix-test-added-in-32444
Fix test added in #32444
2018-04-06 08:13:09 -04:00
yuuji.yaginuma 0bfdd1da28 Fix broken `ServerTest` with Capybara 3.0.0
It seems that it is no longer possible to specify the value held by
`Capybara.server` as sever.

Ref: ba7674086c
2018-04-06 21:01:28 +09:00
bogdanvlviv fd1c8c16c7
Fix test added in #32444
Currently test `#test_logger_does_not_mutate_app_return` doesn't
test mutation of response and the test passes with and without changes
added in #32444. `#freeze` response in the test in order to
test mutation.
2018-04-06 14:00:13 +03:00
Andrew White 457312f54f
Remove redundant type check
All of Date, DateTime and Time respond to `iso8601`.
2018-04-06 11:50:04 +01:00
Edouard CHIN 70fae9a434 `SetupAndTeardown#teardown` should call any subsequent after_teardown:
If you have a regular test that have a teardown block, and for any reason an exception get raised, ActiveSupport will not run subsequent after_teardown method provided by other module or gems.
  One of them being the ActiveRecord::TestFixtures which won't rollback the transation when the test ends making all subsequent test to be in a weird state.

  The default implementation of minitest is to run all teardown methods from the user's test, rescue all exceptions, run all after_teardown methods provided by libraries and finally re-raise the exception that happened in the user's teardown method.
  Rails should do the same.
2018-04-06 04:54:56 -04:00
Rafael França d514ce9199
Merge pull request #32462 from yhirano55/add_ujs_desc_to_rakefile_in_actionview
Add ujs desc to rakefile in actionview
2018-04-04 20:50:24 -04:00
Yoshiyuki Hirano a680de702b Use comment instead of desc in actionview's Rakefile
* Seems the desc of Rake::TestTask.new is not displayed
* Use comment instead of desc
2018-04-05 09:22:24 +09:00
Yoshiyuki Hirano ab2e597240 Add :ujs desc to Rakefile in actionview 2018-04-05 09:22:23 +09:00
Rafael França fe4e9d4c5d
Merge pull request #32441 from composerinteralia/refute-not
Add custom RuboCop for `assert_not` over `refute`
2018-04-04 18:19:35 -04:00
Rafael Mendonça França 826b17cd8a
Merge pull request #32444 from matrinox/fix-return-response-mutation-rack-logger
Stop mutating body response
2018-04-04 18:17:16 -04:00
Rafael França 8d62ff0080
Merge pull request #32446 from sinsoku/add_dig_to_session
Add #dig to ActionDispatch::Request::Session
2018-04-04 17:34:57 -04:00
Rafael França 7252c2133f
Merge pull request #32447 from utilum/splat
2.6 warnings: passing splat keyword arguments as a single Hash
2018-04-04 17:31:58 -04:00
Rafael França 4c2625b7be
Merge pull request #32457 from yhirano55/add_private_option_to_delegation_doc
[ci skip] Add :private option to delegation doc
2018-04-04 15:58:06 -04:00
Yoshiyuki Hirano f0faa86416 [ci skip] Add :private option to delegation doc 2018-04-05 04:39:15 +09:00
Rafael França e1203433c0
Merge pull request #32414 from bogdan/query-cache-optimization
Optimize the code inside AR::QueryCache middleware
2018-04-04 15:23:49 -04:00
Rafael França 2d672ea8ed
Merge pull request #32456 from EiNSTeiN-/patch-1
Remove superfluous `ActionController::`
2018-04-04 14:59:41 -04:00
Francois Chagnon d95626f4c7
Remove superfluous `ActionController::` 2018-04-04 14:20:15 -04:00
Bogdan Gusiev fb75c891ac Optimize the code inside AR::QueryCache middleware 2018-04-04 17:49:06 +03:00
Eileen M. Uchitelle f815e77341
Merge pull request #32435 from bogdanvlviv/add-missing-dots-at-the-end-of-comments
Add missing dots at the end of comments in environment file templates
2018-04-04 07:47:28 -04:00
Eileen M. Uchitelle 50bfb263a1
Merge pull request #32448 from yhirano55/add_private_option_to_delegate_section_in_guide
[ci skip] Add :private option to delegate section in guide
2018-04-04 07:35:39 -04:00
Yoshiyuki Hirano 34a10e0c41 [ci skip] Add :private option to delegate section in guide 2018-04-04 20:05:45 +09:00
utilum 73e9b854d8 passing splat keyword arguments as a single Hash
Ruby 2.6.0 warns about this.
2018-04-04 11:05:14 +02:00
claudiob 398267b142
Add #dig to ActionDispatch::Request::Session
### Summary

The `session` object is not a real Hash but responds to many methods of Hash
such as `[]`, `[]`, `fetch`, `has_key?`.

Since Ruby 2.3, Hash also supports a `dig` method.

This commit adds a `dig` method to `ActionDispatch::Request::Session` with the
same behavior as `Hash#dig`.

This is useful if you store a hash in your session, such as:

```ruby
session[:user] = { id: 1, avatar_url: "http://example.org/nyancat.jpg" }
```

Then you can shorten your code from `session[:user][:avatar_url]` to `session.dig :user, :avatar_url`.

### Other Information

I cherry-picked a commit from https://github.com/rails/rails/pull/23864, and modify a bit.
The changes are below:

* Converts only the first key to a string adjust to the `fetch` method.
* Fixes a test case because we cannot use the indifferent access since ee5b621e2f.
2018-04-04 16:20:16 +09:00
Geoff Lee 0ac64470ea
Stop mutating body response
If @app.call returns an object that is saved (for e.g., in a constant), the mutation results in a continuing cycle of wrapping the body in Rack::BodyProxy, eventually leading to SystemStackError
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
On branch fix-return-response-mutation-rack-logger - Tue  3 Apr 2018 19:54:28 PDT by Geoff Lee <geoff.lee@lendesk.com>
2018-04-03 19:54:27 -07:00
Daniel Colson c1ceafc9d1 Autocorrect `refute` RuboCop violations
73e7aab behaved as expected on codeship, failing the build with
exactly these RuboCop violations. Hopefully `rubocop -a` will
have been enough to get a passing build!
2018-04-03 22:35:49 -04:00
Daniel Colson f88f5a457c Add custom RuboCop for `assert_not` over `refute`
Since at least cf4afc4 we have preferred `assert_not` methods over
`refute` methods. I have seen plenty of comments in PRs about this,
and we have tried to fix it a few times (5294ad8, e45f176, 8910f12,
41f50be, d4cfd54, 48a183e, and 211adb4), but the `refute` methods
keep sneaking back in.

This custom RuboCop will take care of enforcing this preference, so we
don't have to think about it again. I suspect there are other similar
stylistic preferences that could be solved with some custom RuboCops, so
I will definitely keep my eyes open. `assert_not` over `assert !` might
be a good candidate, for example.

I wasn't totally sure if `ci/custom_cops` was the best place to put
this, but nothing else seemed quite right. At one point I had it set up
as a gem, but I think custom cops like this would have limited value
in another context.

I want to see how code climate handles the new cops before
autocorrecting the existing violations. If things go as expected, I will
push another commit with those corrections.
2018-04-03 22:35:34 -04:00
Ryuta Kamizono a07d068078 Class methods in the `class_methods` blocks are wrongly appeared in the doc
It is wrongly appeared as instance public methods in the doc.

http://api.rubyonrails.org/v5.1.6/classes/ActionCable/Channel/Callbacks.html
http://api.rubyonrails.org/v5.1.6/classes/ActiveRecord/Timestamp.html
2018-04-04 09:04:15 +09:00
Yuji Yaginuma 57a9661a9c
Merge pull request #32439 from yhirano55/fix_rendering_test_in_railtie
Fix RenderingTest in railtie
2018-04-04 07:08:58 +09:00
Andrew White 4439bf69b1
Merge pull request #32434 from bogdanvlviv/use-default-option-of-mattr_accessor
Use `:default` option in order to set default value of `finalize_compiled_template_methods`
2018-04-03 22:24:17 +01:00
Yoshiyuki Hirano 53f2241a95 Fix RenderingTest in railtie
Test class name is not `RoutingTest` but `RenderingTest`
2018-04-04 06:12:24 +09:00