aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/route_set.rb
Commit message (Collapse)AuthorAgeFilesLines
* Only path requirements are relevant to optimized urlsAndrew White2014-05-151-1/+1
| | | | | The bit of URL generation that is optimized is the generation of the path so things like :host, :port, etc. are irrelevant.
* Add missing requires for require 'action_dispatch/routing'Andrew White2014-05-151-0/+2
|
* _recall should be set to a hash or not setAaron Patterson2014-05-131-2/+2
| | | | Then we can avoid nil checks
* we never call url_for with a block, so rmAaron Patterson2014-05-131-1/+0
|
* drop || test for cases that do not need itAaron Patterson2014-05-131-3/+3
|
* no need to check for presence, script names can be blankAaron Patterson2014-05-131-2/+2
|
* this method should always have a parameter passed to it, so remove the defaultAaron Patterson2014-05-131-1/+1
|
* options should always be passed to url_forAaron Patterson2014-05-131-2/+2
|
* calls with :host should still use the optimized pathAaron Patterson2014-05-131-2/+2
|
* use fewer method calls to determine the url_for optionsAaron Patterson2014-05-131-5/+4
|
* just merge instead of dup and mergeAaron Patterson2014-05-131-2/+1
|
* the :only_path option is applied by the time the helper is calledAaron Patterson2014-05-131-4/+1
|
* options already have symbolized keys, so we can avoid this callAaron Patterson2014-05-131-1/+1
|
* Get rid of unused methodCarlos Antonio da Silva2014-05-131-11/+0
| | | | It's usage has been removed in 325c9d5e5235db4b5210d9db6c863835d1ac7eed.
* avoid array allocation when extracting usernames and passwordsAaron Patterson2014-05-121-1/+7
|
* Revert "reduce conditionals in url_for"Aaron Patterson2014-05-121-6/+3
| | | | This reverts commit 9df60693d77813b362fb528fc62381ac8f1eec12.
* reduce conditionals in url_forAaron Patterson2014-05-121-3/+6
|
* make the module version quack the same as the instanceAaron Patterson2014-05-121-3/+10
| | | | this way we can stop checking respond_to on every call.
* Hash#except is expensive and this is a hotspot, so use a dup + deleteAaron Patterson2014-05-121-1/+2
|
* Make URL escaping more consistentAndrew White2014-04-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | 1. Escape '%' characters in URLs - only unescaped data should be passed to URL helpers 2. Add an `escape_segment` helper to `Router::Utils` that escapes '/' characters 3. Use `escape_segment` rather than `escape_fragment` in optimized URL generation 4. Use `escape_segment` rather than `escape_path` in URL generation For point 4 there are two exceptions. Firstly, when a route uses wildcard segments (e.g. *foo) then we use `escape_path` as the value may contain '/' characters. This means that wildcard routes can't be optimized. Secondly, if a `:controller` segment is used in the path then this uses `escape_path` as the controller may be namespaced. Fixes #14629, #14636 and #14070.
* Unique the segment keys array for non-optimized url helpersAndrew White2014-01-051-1/+1
| | | | | | | | | | In Rails 3.2 you only needed pass an argument for dynamic segment once so unique the segment keys array to match the number of args. Since the number of args is less than required parts the non-optimized code path is selected. This means to benefit from optimized url generation the arg needs to be specified as many times as it appears in the path. Fixes #12808
* Show full route constraints in error messageAndrew White2014-01-051-2/+3
| | | | | | | | When an optimized helper fails to generate, show the full route constraints in the error message. Previously it would only show the contraints that were required as part of the path. Fixes #13592
* Simplify arg parameterizationAndrew White2014-01-051-6/+1
|
* Use a custom route vistor for optimized route generationAndrew White2014-01-051-27/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using a Regexp to replace dynamic segments in a path string is fraught with difficulty and can lead to odd edge cases like #13349. Since we already have a parsed representation of the path it makes sense to use that to generate an array of segments that can be used to build an optimized route's path quickly. Tests on a simple route (e.g. /posts/:id) show a speedup of 35%: https://gist.github.com/pixeltrix/8261932 Calculating ------------------------------------- Current Helper: 5274 i/100ms New Helper: 8050 i/100ms ------------------------------------------------- Current Helper: 79263.6 (±3.7%) i/s - 395550 in 4.997252s New Helper: 153464.5 (±4.9%) i/s - 772800 in 5.047834s Tests on a more complex route show even an greater performance boost: https://gist.github.com/pixeltrix/8261957 Calculating ------------------------------------- Current Helper: 2367 i/100ms New Helper: 5382 i/100ms ------------------------------------------------- Current Helper: 29506.0 (±3.2%) i/s - 149121 in 5.059294s New Helper: 78815.5 (±4.1%) i/s - 398268 in 5.062161s It also has the added benefit of fixing the edge cases described above. Fixes #13349
* Spelling and Grammar checksAkshay Vishnoi2013-12-121-1/+1
|
* Merge pull request #12216 from suginoy/a-anRafael Mendonça França2013-09-131-1/+1
|\ | | | | Fix typos: the indefinite articles(a -> an).
| * Fix typos: the indefinite articles(a -> an)SUGINO Yasuhiro2013-09-131-1/+1
| |
* | Refactor handling of action normalizationMax Shytikov2013-09-101-11/+13
|/ | | | | | Reference: Bloody mess internals http://gusiev.com/slides/rails_contribution/static/#40
* Revert "Merge branch 'master' of github.com:rails/docrails"Vijay Dev2013-08-171-13/+11
| | | | | | | This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9. Seems to be a code merge done by mistake.
* Refactor handling of action normalizationMax Shytikov2013-07-261-11/+13
| | | | | | Reference: Bloody mess internals http://gusiev.com/slides/rails_contribution/static/#40
* Refactor to reduce number of loopsAndrew White2013-07-171-15/+25
| | | | | | Only build the missing_keys array once we have detected that there actually are missing keys by moving the check to be part of the block that performs the path substitution.
* Fix failing test missed for the past year :(Andrew White2013-07-171-2/+17
| | | | | | | | | When optimized path helpers were re-introduced in d7014bc the test added in a328f2f broke but no-one noticed because it wasn't being run by the test suite. Fix the test by checking for nil values or empty strings after the args have been parameterized.
* Fix named routing regression from 3.2.13schneems2013-05-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | When named route that is nested is used in 3.2.13 Example `routes.rb`: ``` resources :nested do resources :builder, :controller => 'nested/builder' end ``` In 3.2.12 and 3.2.12 this named route would work: ``` nested_builder_path(:last_step, :nested_id => "foo") ``` Generating a url that looks like `/nested/foo/builder/last_step`. This PR fixes the regression when building urls via the optimized helper. Any explicit keys set in the options are removed from the list of implicitly mapped keys. Not sure if this is exactly how the original version worked, but this fixes this use case regression.
* Duplicate options before mutating themAndrew White2013-04-181-3/+4
|
* Mark unused variables and make some style fixesAgis Anastasopoulos2013-04-081-1/+1
| | | | It'd be a nice convention to mark the unused variables like this, now that Ruby 2 will issue no warnings for such vars being unused.
* fix wrong argument error messageVipul A M2013-03-311-1/+1
|
* Tweak exception message to avoid giving potentially misleading suggestionsTrevor Turk2013-03-201-2/+3
|
* Raise an ArgumentError when a clashing named route is definedTrevor Turk2013-03-191-1/+8
|
* Use custom visitor class for optimized url helpersAndrew White2013-03-031-9/+1
| | | | | | | | Rather than trying to use gsub to remove the optional route segments, which will fail with nested optional segments, use a custom visitor class that returns a empty string for group nodes. Closes #9524
* allow non-String default params in the router.Yves Senn2013-02-261-0/+2
| | | | | | | Closes #9435. Skip valid encoding checks for non-String parameters that come from the matched route's defaults.
* Missing or unneeded require extract_optionsAkira Matsuda2013-02-011-0/+1
|
* remove dead codeAaron Patterson2013-01-301-4/+1
|
* change parameter name for positional argsAaron Patterson2013-01-301-2/+1
|
* nodoc the helper classes, cache stuff for optimized helperAaron Patterson2013-01-301-13/+17
|
* cache path parts in the instanceAaron Patterson2013-01-301-2/+3
|
* stop evaling a string every timeAaron Patterson2013-01-301-4/+4
|
* moving helper classes outside the private blockAaron Patterson2013-01-301-90/+88
|
* pushing specialization down to the optimized classAaron Patterson2013-01-301-23/+25
|
* use polymorphism to remove conditionalAaron Patterson2013-01-301-35/+27
|
* move conditionals to instanceAaron Patterson2013-01-301-6/+16
|