aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
Commit message (Collapse)AuthorAgeFilesLines
* Fix Style/RedundantReturn offensesBart de Water2018-04-211-1/+1
|
* Small doc fixesT.J. Schuck2018-04-021-1/+1
| | | | [ci skip]
* Make engine check more explicitAndrew White2018-03-251-6/+9
| | | | | | | | 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.
* Cache url helpers moduleAndrew White2018-03-211-1/+2
| | | | | 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.
* Rely on Rails::Command's help output.Kasper Timm Hansen2018-03-131-26/+21
| | | | | | | | | | | | | | | | | | | | | 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.
* Introduce `ActionDispatch::Routing::ConsoleFormatter::Base`bogdanvlviv2018-03-131-41/+34
| | | | | | | | | | | | | | - 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
* Merge pull request #32160 from bogdanvlviv/improve-rails-routes-expandedKasper Timm Hansen2018-03-111-1/+10
|\ | | | | Draw line of a route name to the end of row console on `rails routes --expanded`
| * Draw line of a route name to the end of row console on `rails routes --expanded`bogdanvlviv2018-03-051-1/+10
| | | | | | | | | | | | | | 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
* | Change doc for "polymorphic_path" in polymorphic_routes.rbMahmoud2018-03-091-2/+1
| | | | | | | | | | The method 'polymorphic_path' is not using 'polymorphic_url' with `routing_type: :path` anymore in polymorphic_routes.rb
* | Quote string return values in doc examples [ci skip]Andrew White2018-03-081-2/+2
| |
* | Add example of maintaining context with `route_for`Andrew White2018-03-081-0/+6
| | | | | | | | [ci skip]
* | Express `ActionDispatch::Routing::UrlFor#route_for` as public apibogdanvlviv2018-03-071-1/+13
|/ | | | | | | | | 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
* `ConsoleFormatter` is no longer used as a classRyuta Kamizono2018-03-021-2/+2
| | | | It is used as a namespace for `Sheet` and `Expanded`.
* Add --expanded option to "rails routes"Benoit Tigeot2018-02-281-37/+90
| | | | | | | | | | | | | | | | | | | | | | | | | 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 | {}
* Avoid method_redefined warnings in RouteSet::NamedRouteCollectionutilum2018-02-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-162-6/+5
| | | | | 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.
* Unused core_extAkira Matsuda2018-02-111-1/+0
|
* Make sure assert_recognizes can still find routes mounted after enginesRafael Mendonça França2018-02-091-4/+6
| | | | | Before, if the application defined after an engine this method would not recognize the route since it was not defined insdie the engine.
* Fix typos. Improve text_helper documentation.James Lovejoy2018-01-191-3/+3
| | | | [ci skip]
* Fix optimized url helpers when using relative url rootAndrew White2017-11-281-0/+10
| | | | Fixes #31220.
* Fix CustomUrls#direct doc formattingT.J. Schuck2017-11-221-6/+6
| | | | | 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]
* Update incorrect backtick usage in RDoc to teletypeT.J. Schuck2017-11-221-1/+1
| | | [ci skip]
* Merge pull request #22435 from yui-knk/fix_engine_route_testRafael Mendonça França2017-11-063-6/+15
|\ | | | | | | Make `assert_recognizes` to traverse mounted engines
| * Make `assert_recognizes` to traverse mounted enginesyui-knk2016-04-233-6/+15
| | | | | | | | | | | | 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.
* | Improve docs of ActionDispatch::Routing::Mapperbogdanvlviv2017-11-031-4/+14
| |
* | Change the deprecation horizon of the dynamic routes segment to 6.0Rafael Mendonça França2017-10-231-2/+2
| |
* | [Action Pack] require => require_relativeAkira Matsuda2017-10-213-7/+7
| | | | | | | | | | This basically reverts e9fca7668b9eba82bcc832cb0061459703368397, d08da958b9ae17d4bbe4c9d7db497ece2450db5f, d1fe1dcf8ab1c0210a37c2a78c1ee52cf199a66d, and 68eaf7b4d5f2bb56d939f71c5ece2d61cf6680a3
* | Clarify intentions around method redefinitionsMatthew Draper2017-09-011-1/+2
| | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'master' of github.com:rails/docrailsVijay Dev2017-08-261-1/+1
|\ \
| * | [ci skip] Fix a typoyui-knk2017-08-181-1/+1
| | | | | | | | | | | | We always plural form for `resources` method.
* | | Use tt in doc for ActionPack [ci skip]Yoshiyuki Hirano2017-08-262-4/+4
| | |
* | | fix typo in ambiguous route definition error messageZoran Pesic2017-08-181-1/+1
|/ /
* | Use frozen string literal in actionpack/Kir Shatrov2017-07-296-0/+12
| |
* | Fix regression from multiple mountpoint supportDavid Rodríguez2017-07-242-1/+27
| |
* | [Action Pack] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-112-0/+2
| |
* | Merge pull request #29655 from kirs/frozen-friendly-ap-arMatthew Draper2017-07-102-2/+4
|\ \ | | | | | | Prepare AP and AR to be frozen string friendly
| * | Prepare AP and AR to be frozen string friendlyKir Shatrov2017-07-062-2/+4
| | |
* | | Allow mounting same engine under several locationsDavid Rodríguez2017-07-053-10/+20
|/ /
* | Merge branch 'master' into require_relative_2017Xavier Noria2017-07-021-18/+11
|\ \
| * | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-028-8/+0
| | | | | | | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * | Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-028-0/+8
| |\ \ | | | | | | | | | | | | Enforce frozen string in Rubocop
| | * | Enforce frozen string in RubocopKir Shatrov2017-07-018-0/+8
| | | |
| * | | Merge pull request #29644 from wilson/unify-route-helper-visibilityMatthew Draper2017-07-011-18/+11
| |\ \ \ | | |/ / | |/| | | | | | Properly register "custom" URL helpers as named helpers.
| | * | Properly register "custom" URL helpers as named helpers.Wilson Bilkovich2017-06-301-18/+10
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* / / [Action Dispatch] require => require_relativeAkira Matsuda2017-07-013-7/+7
|/ /
* | Fix missing formats in route-set URLsJonathan del Strother2017-06-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | 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!)
* | Fix typo on error message when route definition is ambiguous.André Luis Leal Cardoso Junior2017-06-031-1/+1
| |
* | Fix formatting of `direct` and `resolve` doc [ci skip]yuuji.yaginuma2017-06-031-14/+14
| |
* | `respond_to_missing?` should be privateRyuta Kamizono2017-04-221-2/+3
| | | | | | | | | | | | | | Follow up of 03d3f036. Some of `respond_to?` were replaced to `respond_to_missing?` in 03d3f036. But the visibility is still public. It should be private.
* | Reuse the Parameters#to_h check in the routing helpersRafael Mendonça França2017-04-182-15/+4
| | | | | | | | | | Since this protection is now in Parameters we can use it instead of reimplementing again.