| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | | |
|
|/ / / /
| | | |
| | | | |
ActionDispatch::TestProcess::FixtureFile
|
| | | | |
|
| |/ /
|/| | |
|
| | |
| | |
| | |
| | | |
Fixes #33634.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Purpose metadata prevents cookie values from being
copy-pasted and ensures that the cookie is used only
for its originally intended purpose.
The Purpose and Expiry metadata are embedded inside signed/encrypted
cookies and will not be readable on previous versions of Rails.
We can switch off purpose and expiry metadata embedded in
signed and encrypted cookies using
config.action_dispatch.use_cookies_with_metadata = false
if you want your cookies to be readable on older versions of Rails.
|
| | |
| | |
| | |
| | |
| | | |
In cases where the MatchData object is not used, this provides a speed-up:
https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails
Prefer rails command over bin/rails
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
As discussed in #33203 rails command already looks for, and runs,
bin/rails if it is present.
We were mixing recommendations within guides and USAGE guidelines,
in some files we recommended using rails, in others bin/rails and
in some cases we even had both options mixed together.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
http links will be redirected to the https version, but still better to
just directly link to the https version.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
* Add implicit to path conversion to uploaded file
Ruby has a few implicit conversion protocols (e.g. `to_hash`, `to_str`,
`to_path`, etc.). These are considered implicit conversion protocols
because in certain instances Ruby (MRI core objects) will check if an
argument responds to the appropriate protocol and automatically convert
it when it does; this is why you can provide a `Pathname` instance into
`File.read` without having to explicitly call `to_s`.
```ruby
a_file_path = 'some/path/file.ext'
File.write a_file_path, 'String Path Content'
File.read a_file_path
a_pathname = Pathname(a_file_path)
File.write core_file, 'Pathname Content'
File.read a_file_path
core_file = File.new(a_pathname)
File.write core_file, 'File Content'
File.read core_file
tmp_file = Tempfile.new('example')
File.write tmp_file, 'Tempfile Content'
File.read tmp_file
```
So how does an uploaded file work in such cases?
```ruby
tmp_file = Tempfile.new('example')
File.write tmp_file, 'Uploaded Content'
uploaded_file = ActionDispatch::Http::UploadedFile.new(tempfile: tmp_file)
File.read uploaded_file
```
It fails with a `TypeError`:
no implicit conversion of ActionDispatch::Http::UploadedFile into String
In order to make an uploaded file work it must be explicitly converted
to a file path using `path`.
```ruby
File.read uploaded_file.path
```
This requires any code that expects path/file like objects to either
special case an uploaded file, re-implement the path conversion protocol
to use `path`, or forces the developer to explicitly cast uploaded files
to paths. This last option can sometimes be difficult to do when such
calls are deep within the inner workings of libraries.
Since an uploaded file already has a path it makes sense to implement
the implicit "path" conversion protocol (just like `File` and
`Tempfile`). This change allows uploaded file content to be treated more
closely to regular file content, without requiring any special case
handling or explicit conversion for common file utilities.
* Note uploaded file path delegation in CHANGELOG
|
|\ \ \ \
| | | | |
| | | | | |
Show nested exceptions on the debug view
|
| | | | | |
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When a `get` method called with `as: :json` and `params: nil` or
`params: false` (explicitly or implicitly)
`RequestEncoder#encode_params` converts it into a `null` or `false`
value which includes a unexpected `null=` or `false` query string into
request URL. From now on `RequestEncoder#encode_params` checks whether
`params` is nil or not otherwise returns.
Move down `nil` conversion guard
Update CHANGELOG.md
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | | |
We sometimes ask "✂️ extra blank lines" to a contributor in reviews like
https://github.com/rails/rails/pull/33337#discussion_r201509738.
It is preferable to deal automatically without depending on manpower.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* Allow get arguments for follow_redirect
Now all arguments passed to `follow_redirect!` are passed to the
underlying `get` method. This for example allows to set custom headers
for the redirection request to the server.
This is especially useful for setting headers that may, outside of the
testing environment, be set automatically on every request, i.e. by a
web application firewall.
* Allow get arguments for follow_redirect
[Remo Fritzsche + Rafael Mendonça França]
|
|\ \ \
| | | |
| | | | |
Fix route eager loading
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
From <https://tools.ietf.org/html/rfc5861>:
> The stale-if-error HTTP Cache-Control extension allows a cache to
> return a stale response when an error -- e.g., a 500 Internal Server
> Error, a network segment, or DNS failure -- is encountered, rather
> than returning a "hard" error. This improves availability.
>
> The stale-while-revalidate HTTP Cache-Control extension allows a
> cache to immediately return a stale response while it revalidates it
> in the background, thereby hiding latency (both in the network and on
> the server) from clients.
These are useful, fully standardized parts of the HTTP protocol with
widespread support among CDN vendors. Supporting them will make it
easier to utilize reverse proxies and CDNs from Rails.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Rails no longer generates this file, but Google is still packed with results
suggesting it should exist, so that the doc still pointed me to it threw me
off (had I deleted it or something?). Probably be better to be vague and
prompt the user to stick it in a config file they own.
#33124
|
|/ / /
| | |
| | |
| | |
| | | |
Modifies the routes simulator to allow for empty RouteSets, which are
created when secondary Engines are loaded.
|
|/ /
| |
| |
| |
| |
| | |
Introduced in rails/journey@a806beb
[ci skip]
|
|\ \
| | |
| | |
| | |
| | | |
Updates documentation on ActionDispatch::Integration::Session#process
[ci skip]
|
| | |
| | |
| | |
| | |
| | |
| | | |
Adds missing information on 2 parameters: +xhr+ and +as+
[ci skip]
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Specification: https://w3c.github.io/webappsec-csp/#directive-prefetch-src
This directive can already be used as an experimental feature in Chrome.
Ref: https://bugs.chromium.org/p/chromium/issues/detail?id=801561
|
|\ \ \
| | | |
| | | | |
Use strict_encode64 instead of gsub newline for ScreenshotHelper
|
| | | | |
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since other views use the `h2` tag, should also use `h2` on
`missing_exact_template.html.erb`.
https://github.com/rails/rails/blob/76acaf6eb9ef3635e4c6f2ca9dba34edb50f541d/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb#L5
https://github.com/rails/rails/blob/76acaf6eb9ef3635e4c6f2ca9dba34edb50f541d/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb#L11
https://github.com/rails/rails/blob/76acaf6eb9ef3635e4c6f2ca9dba34edb50f541d/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb#L5
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | | |
Create MissingExactTemplate exception with separate template
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Fix typos related to ActionDispatch::Http::FilterParameters
|
| | | | |
| | | | |
| | | | |
| | | | | |
Fixes two documentation typos found at ActionDispatch::Http::FilterParameters
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Plugins interacting with the exceptions caught and displayed by
ActionDispatch::DebugExceptions currently have to monkey patch it to get
the much needed exception for their calculation.
With DebugExceptions.register_interceptor, plugin authors can hook into
DebugExceptions and process the exception, before being rendered. They
can store it into the request and process it on the way back of the
middleware chain execution or act on it straight in the interceptor.
The interceptors can be play blocks, procs, lambdas or any object that
responds to `#call`.
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
This commit fixes all references in the codebase missing a trailing :,
which causes the nodoc not to actually work :) [skip ci]
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
There's no reason to block future versions of Capybara since we don't
_know_ they are going to break. How will we know if we have a
conservative option set? This change prevents us from blocking users who
want to upgrade in the future.
|
| | | |
| | | |
| | | | |
Per Chromium team this has not been necessary on other platforms for quite some time: https://bugs.chromium.org/p/chromium/issues/detail?id=737678#c1
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In #32446 was added method `dig` to `session`.
Improve docs of method `dig`.
[ci skip]
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
### 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 ee5b621e2f8fde380ea4bc75b0b9d6f98499f511.
|
| | | |
| | | |
| | | |
| | | | |
[ci skip]
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Not everything that responds to `routes` is a Rails engine - for example
a Grape API endpoint will have a `routes` method but can't be used with
`assert_recognizes` as it doesn't respond to `recognize_path_with_request`.
Fixes #32312.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The rack gem returns PATH_INFO as an ASCII-8BIT encoded string but it
was being converted to US-ASCII by the match? method because it was
calling Rack::Utils.escape_path. To prevent incompatibile encoding
warnings use ASCII-8BIT strings for the root path and let Ruby handle
any filename encoding conversion.
Fixes #32294, Closes #32314.
|
|\ \ \ \
| | | | |
| | | | | |
Fix system tests transactions not closed between examples
|
| | | | | |
|
|/ / / /
| | | |
| | | |
| | | |
| | | | |
The urls helpers module returned by Rails.application.routes.url_helpers
isn't cached so to prevent the cost of building the module cache it locally.
|