| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
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
|
|
|
|
|
| |
http links will be redirected to the https version, but still better to
just directly link to the https version.
|
| |
|
|
|
|
| |
[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 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We end up with:
```
Usage:
bin/rails routes [options]
Options:
-c, [--controller=CONTROLLER] # Filter by a specific controller, e.g. PostsController or Admin::PostsController.
-g, [--grep=GREP] # Grep routes by a specific pattern.
-E, [--expanded], [--no-expanded] # Print routes expanded vertically with parts explained.
```
which does miss the bit about routes being printed in order.
Also:
* Renames options to ease help output readability, then clarifies each option.
* Fixes a bunch of indentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Create `Base` and inherit `Sheet` and `Expanded` in order to
- prevent code duplication.
- Remove trailing "\n" for components of `Expanded`.
- There is no need for `Expanded#header` to return `@buffer` so return `nil` instead.
- Change `no_routes` message "No routes were found for this controller"
since if use `-g`, it sounds incorrect.
- Display `No routes were found for this controller.` if apply `-c`.
- Display `No routes were found for this grep pattern.` if apply `-g`.
Related to #32130
|
|\
| |
| | |
Draw line of a route name to the end of row console on `rails routes --expanded`
|
| |
| |
| |
| |
| |
| |
| | |
In order to get width of console use `IO::console_size`,
See https://ruby-doc.org/stdlib-2.4.1/libdoc/io/console/rdoc/IO.html#method-c-console_size
Related to #32130
|
| |
| |
| |
| |
| | |
The method 'polymorphic_path' is not using 'polymorphic_url'
with `routing_type: :path` anymore in polymorphic_routes.rb
|
| | |
|
| |
| |
| |
| | |
[ci skip]
|
|/
|
|
|
|
|
|
|
| |
This method was added by #28462 but marked as private api.
Since `route_for` looks good in pair with `ActionDispatch::Routing::Mapper::CustomUrls#direct`
let's make it as public api.
We use it in https://github.com/rails/rails/blob/e83575ff533690db86c92447a539d76b648e9fed/activestorage/config/routes.rb
Closes #31417
|
|
|
|
| |
It is used as a namespace for `Sheet` and `Expanded`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When using rails routes with small terminal or complicated routes it can be
very difficult to understand where is the element listed in header. psql
had the same issue, that's why they created "expanded mode" you can
switch using `\x` or by starting psql with
```
-x
--expanded
Turn on the expanded table formatting mode. This is equivalent to the \x command.
```
The output is similar to one implemented here for rails routes:
db_user-# \du
List of roles
-[ RECORD 1 ]----------------------------------------------
Role name | super
Attributes | Superuser, Create role, Create DB
Member of | {}
-[ RECORD 2 ]----------------------------------------------
Role name | role
Attributes | Superuser, Create role, Create DB, Replication
Member of | {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
```
~/.rbenv/versions/2.5.0/bin/ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/routing_test.rb
Run options: --seed 5851
.......~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here
....~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here
..........~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url
~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here
.....
Finished in 13.233638s, 1.9647 runs/s, 5.8185 assertions/s.
26 runs, 77 assertions, 0 failures, 0 errors, 0 skips
```
After:
```
~/.rbenv/versions/2.5.0/bin/ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/routing_test.rb
Run options: --seed 38072
..........................
Finished in 12.009632s, 2.1649 runs/s, 6.4115 assertions/s.
26 runs, 77 assertions, 0 failures, 0 errors, 0 skips
```
|
|
|
|
|
| |
Some places we can't remove because Ruby still don't have a method
equivalent to strip_heredoc to be called in an already existent string.
|
| |
|
|
|
|
|
| |
Before, if the application defined after an engine this method would not
recognize the route since it was not defined insdie the engine.
|
|
|
|
| |
[ci skip]
|
|
|
|
| |
Fixes #31220.
|
|
|
|
|
| |
Particularly, the bulleted list was getting formatted as a code block because of the extra level of indentation. Pulling it back to the left makes it render properly as a list instead.
[ci skip]
|
|
|
| |
[ci skip]
|
|\
| |
| |
| | |
Make `assert_recognizes` to traverse mounted engines
|
| |
| |
| |
| |
| |
| | |
Before this commit paths of mounted engines are not traversed
when `assert_recognizes` is called, causing strange test results.
This commit enable to traverse mounted paths.
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
This basically reverts e9fca7668b9eba82bcc832cb0061459703368397, d08da958b9ae17d4bbe4c9d7db497ece2450db5f,
d1fe1dcf8ab1c0210a37c2a78c1ee52cf199a66d, and 68eaf7b4d5f2bb56d939f71c5ece2d61cf6680a3
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Don't use remove_method or remove_possible_method just before a new
definition: at best the purpose is unclear, and at worst it creates a
race condition.
Instead, prefer redefine_method when practical, and
silence_redefinition_of_method otherwise.
|
|\ \ |
|
| | |
| | |
| | |
| | | |
We always plural form for `resources` method.
|
| | | |
|
|/ / |
|
| | |
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Prepare AP and AR to be frozen string friendly
|
| | | |
|
|/ / |
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | | |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |\ \
| | | |
| | | |
| | | | |
Enforce frozen string in Rubocop
|
| | | | |
|
| |\ \ \
| | |/ /
| |/| |
| | | | |
Properly register "custom" URL helpers as named helpers.
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
CustomUrlHelpers were introduced in ce7d5fb2e6, closing issue #22512.
They currently register themselves in an ivar that is never accessed.
This change removes the @custom_helpers special-case, and registers them
the way named routes are normally handled.
Without this, you can get route_defined?(:example_url) == false, while
still being able to call url_helpers.example_url and example_path.
Various popular gems such as 'rspec-rails' make use of route_defined?()
when determining how to proxy method calls or whether to define a route.
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Before this change, handle_positional_args would end up mutating @segment_keys
if inner_options included path components. Subsequent calls would then
be missing the implicit path components.
eg:
user_path(1, :json) # => "/users/1.json" (correct)
user_path(1, format: :json) # => "/users/1.json" (correct, but @segment_keys was mutated)
user_path(1, :json) # => "/users/1" (oh no!)
|
| | |
|
| | |
|