aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | Use more specific check for :format in route pathAndrew White2017-04-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current check for whether to add an optional format to the path is very lax and will match things like `:format_id` where there are nested resources, e.g: resources :formats do resources :items end Fix this by using a more restrictive regex pattern that looks for the patterns `(.:format)`, `.:format` or `/` at the end of the path. Note that we need to allow for multiple closing parenthesis since the route may be of this form: get "/books(/:action(.:format))", controller: "books" This probably isn't what's intended since it means that the default index action route doesn't support a format but we have a test for it so we need to allow it. Fixes #28517.
* | Merge pull request #28394 from shime/docs-action-dispatchXavier Noria2017-03-225-31/+31
|\ \ | | | | | | [docs] fix ActionDispatch documentation
| * | [docs] fix ActionDispatch documentationHrvoje Šimić2017-03-135-31/+31
| | |
* | | Always use original url_for when generating direct routesAndrew White2017-03-172-1/+9
| | | | | | | | | | | | | | | | | | | | | Action View overrides `url_for` in the view context to render paths by default when using `url_for` and this means that direct route helpers don't get the full url when called with the url suffix. To fix this always call the original `url_for`.
* | | Add support for calling nested direct routes (#28462)Andrew White2017-03-173-24/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all requirements can be expressed in terms of polymorphic url options so add a `route_for` method that allows calling another direct route (or regular named route) which a set of arguments, e.g: resources :buckets direct :recordable do |recording| route_for(:bucket, recording.bucket) end direct :threadable do |threadable| route_for(:recordable, threadable.parent) end This maintains the context of the original caller, e.g. threadable_path(threadable) # => /buckets/1 threadable_url(threadable) # => http://example.com/buckets/1
* | | Remove unnecessary params mungingAndrew White2017-03-151-2/+1
|/ / | | | | | | | | | | | | | | | | | | In 9b654d4 some params munging was added to ensure that they were set whenever `recognize_path` would call either a proc or callable constraint. Since we no longer mutate the environment hash within the method it's now unnecessary and actually causes params to leak between route matches before checking constraints. Fixes #28398.
* | Fix `direct` with params example [ci skip]yuuji.yaginuma2017-03-061-1/+1
| | | | | | | | | | | | | | Since `ActionController:Parameters` does not inherit `Hash`, need to explicitly convert it to `Hash`. Also, `Parameters#to_h` returns `Hash` whose key is `String`. Therefore, if merge as it is, the value will not be overwritten as expected.
* | Remove unused params.Jerry Tao2017-02-262-2/+2
| |
* | Commit flash changes when using a redirect route.Andrew White2017-02-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | In ca324a0 the flash middleware was effectively removed by its constructor returning the app it was passed and the `commit_flash` call was moved to the `ActionController::Metal#dispatch` method. This broke any redirect routes that modified the flash because the redirect happens before `dispatch` gets called. To fix it, this commit adds a `commit_flash` call in the `serve` method of `ActionDispatch::Routing::Redirect`. Fixes #27992.
* | [ci skip] Fix more quotes in direct/resolve docsAndrew White2017-02-231-3/+3
| | | | | | | | Also correct use of `direct class:` to `resolve` in example.
* | Clarify use of params in `direct`Andrew White2017-02-221-0/+9
| | | | | | | | | | | | | | | | | | Since a `direct` url helper block is evaluated using `instance_exec` then methods that are available in the instance context can be accessed, e.g. the params object in a controller action or view. This wasn't clear from the example so expand on that point and add a test case for this situation.
* | Bump removal of `/:controller/:action` to Rails 5.2Andrew White2017-02-221-2/+2
| |
* | [ci skip] Fix direct/resolve documentation.Kasper Timm Hansen2017-02-211-11/+11
| | | | | | | | Use double quoted strings, come down hard on some typos.
* | Split direct method into twoAndrew White2017-02-212-49/+56
| | | | | | | | | | Use a separate method called `resolve` for the custom polymorphic mapping to clarify the API.
* | Push option extract into call methodAndrew White2017-02-212-8/+7
| |
* | Fix typo in exception messageAndrew White2017-02-211-1/+1
| |
* | Prefer remove_method over undef_methodAndrew White2017-02-211-4/+4
| | | | | | | | | | | | Using `undef_method` means that when a route is removed any other implementations of that method in the ancestor chain are inaccessible so instead use `remove_method` which restores access to the ancestor.
* | Support mapping of non-model classesAndrew White2017-02-211-3/+10
| |
* | Raise an error if `direct` is inside a scope blockAndrew White2017-02-211-3/+14
| |
* | Add custom polymorphic mappingAndrew White2017-02-213-56/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the use of `direct` to specify custom mappings for polymorphic_url, e.g: resource :basket direct(class: "Basket") { [:basket] } This will then generate the following: >> link_to "Basket", @basket => <a href="/basket">Basket</a> More importantly it will generate the correct url when used with `form_for`. Fixes #1769.
* | Don't allocate a hash unnecessarilyAndrew White2017-02-212-2/+6
| |