| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Fixes an issue that would cause default_url_options to be lost when generating
URLs with fewer positional arguments than parameters in the route definition.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I found delegate to be a bottleneck during integration tests. Here is
the test case:
```ruby
require 'test_helper'
class DocumentsIntegrationTest < ActionDispatch::IntegrationTest
test "index" do
get '/documents'
assert_equal 200, response.status
end
end
Minitest.run_one_method(DocumentsIntegrationTest, 'test_index')
StackProf.run(mode: :wall, out: 'stackprof.dump') do
3000.times do
Minitest.run_one_method(DocumentsIntegrationTest, 'test_index')
end
end
```
Top of the stack:
```
[aaron@TC integration_performance_test (master)]$ stackprof stackprof.dump
==================================
Mode: wall(1000)
Samples: 23694 (7.26% miss rate)
GC: 1584 (6.69%)
==================================
TOTAL (pct) SAMPLES (pct) FRAME
7058 (29.8%) 6178 (26.1%) block in Module#delegate
680 (2.9%) 680 (2.9%) ActiveSupport::PerThreadRegistry#instance
405 (1.7%) 405 (1.7%) ThreadSafe::NonConcurrentCacheBackend#[]
383 (1.6%) 383 (1.6%) Set#include?
317 (1.3%) 317 (1.3%) ActiveRecord::Base.logger
281 (1.2%) 281 (1.2%) Rack::Utils::HeaderHash#[]=
269 (1.1%) 269 (1.1%) ActiveSupport::Notifications::Fanout::Subscribers::Evented#subscribed_to?
262 (1.1%) 262 (1.1%) block (4 levels) in Class#class_attribute
384 (1.6%) 246 (1.0%) block (2 levels) in Class#class_attribute
```
According to @eileencodes's tests, this speeds up integration tests so
that they are only 1.4x slower than functional tests:
Before:
INDEX: Integration Test: 153.2 i/s - 2.43x slower
After:
INDEX: Integration Test: 275.1 i/s - 1.41x slower
|
|
|
|
| |
These requires were added only to change deprecation message
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
There is no need to subtract one from the path_params size when there is
no format parameter because it is not present in the path_params array.
Fixes #17819.
|
|
|
|
| |
`_generate_paths_by_default` should always be private.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Closes #17615 #17616
when script_name is nil in the options hash, script_name is set to nil.
options = {script_name: nil}
script_name = options.delete(:script_name) {‘’} # => nil
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
|
|\ |
|
| |
| |
| |
| |
| |
| | |
Fixes https://github.com/rails/rails/issues/16958
[Byron Bischoff & Melanie Gilman]
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch uniformizes warning messages. I used the most common style
already present in the code base:
* Capitalize the first word.
* End the message with a full stop.
* "Rails 5" instead of "Rails 5.0".
* Backticks for method names and inline code.
Also, converted a few long strings into the new heredoc convention.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current style for warning messages without newlines uses
concatenation of string literals with manual trailing spaces
where needed.
Heredocs have better readability, and with `squish` we can still
produce a single line.
This is a similar use case to the one that motivated defining
`strip_heredoc`, heredocs are super clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
In cases where this option is set to `true`, the option is redundant and can
be safely removed; otherwise, the corresponding `*_url` helper should be
used instead.
Fixes #17294.
See also #17363.
[Dan Olson, Godfrey Chan]
|
|
|
|
|
|
|
|
| |
This reverts commit 9d05d6de52871e57bfbf54a60de005e8a5f5b0e4, reversing
changes made to 0863c9248fd47a15e88e05ce4fcd80966684c0e3.
The change in the behaviour reported at #16958 doesn't exist since 4.0
and 4.1 works in the same way
|
| |
|
|
|
|
|
|
| |
This method was removed at 210b338db20b1cdd0684f40bd78b52ed16148b99 but it is
used by third party gems to check if a named route was defined. To help on the
upgrade path on 4.2.0 we bring it back and emit a deprecation warning.
|
|
|
|
|
| |
we know that this call only wants the path returned, so lets call a
method that returns the path.
|
|
|
|
| |
this allows us to avoid nil checks on the return value
|
|
|
|
| |
hash lookup should be faster than searching an array.
|
|
|
|
|
| |
every call to default_resources_path_names allocates a new hash, no need
to dup
|
|
|
|
| |
we can `super` in to the previous implementation.
|
|
|
|
|
| |
we already know what helpers are path helpers, so just iterate through
that list and define the helpers with warnings
|
| |
|
|
|
|
|
| |
this lets us avoid hard coding a regexp for separating path and url
helpers in the clear! method.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Email does not support relative links since there is no implicit host. Therefore all links inside of emails must be fully qualified URLs. All path helpers are now deprecated. When removed, the error will give early indication to developers to use `*_url` methods instead.
Currently if a developer uses a `*_path` helper, their tests and `mail_view` will not catch the mistake. The only way to see the error is by sending emails in production. Preventing sending out emails with non-working path's is the desired end goal of this PR.
Currently path helpers are mixed-in to controllers (the ActionMailer::Base acts as a controller). All `*_url` and `*_path` helpers are made available through the same module. This PR separates this behavior into two modules so we can extend the `*_path` methods to add a Deprecation to them. Once deprecated we can use this same area to raise a NoMethodError and add an informative message directing the developer to use `*_url` instead.
The module with warnings is only mixed in when a controller returns false from the newly added `supports_relative_path?`.
Paired @sgrif & @schneems
|
|
|
|
| |
use helpers.include? so we don't get any false positives
|
|
|
|
|
| |
we should not be accessing internals to figure out if a method is
defined.
|
|
|
|
|
| |
since helpers is a set, we can be confident about when to remove methods
from the module.
|
|
|
|
| |
after this, we can disconnect @module from the instance
|
|
|
|
| |
we can cache the module on the stack, then reuse it
|
| |
|
|
|
|
|
| |
we know the routes should not be "optimized" when mounting an
application
|
|
|
|
|
| |
this allows us to avoid 2 hash allocations per named helper definition,
also we can avoid a `merge` and `delete`.
|
|
|
|
|
|
| |
since we know that the route should be a path or fully qualified, we can
pass a strategy object that handles generation. This allows us to
eliminate an "if only_path" branch when generating urls.
|
| |
|
|
|
|
|
| |
If we extract the options from the user facing method call ASAP, then we
can simplify internal logic.
|
|
|
|
| |
Now we can override how requests are dispatched in the routeset object
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|