aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/url.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add docs for ActionDispatch::Http::URL methodsclaudiob2014-12-181-0/+109
| | | | | | | | | | Add docs for `extract_domain`, `extract_subdomains`, `extract_subdomain`. Add doc examples for `url`, `protocol`, `raw_host_with_port`, `host`, `host_with_port`, `port`, `standard_port`, `standard_port?`, `optional_port`, `port_string`. [ci skip]
* Anchor should not be appended when set to nil/false.Guo Xiang Tan2014-11-231-1/+3
| | | | Fixes https://github.com/rails/rails/issues/17714.
* Realign assignments :scissors:Carlos Antonio da Silva2014-07-311-5/+5
|
* Do not reassign variable when mutation is happeningCarlos Antonio da Silva2014-07-311-8/+5
| | | | | These methods mutate the path variable/argument so there is no need to reassign it every time.
* Only concatenate path if it was given rather than converting blindlyCarlos Antonio da Silva2014-07-311-1/+1
|
* Rename variable to better show its intentCarlos Antonio da Silva2014-07-311-12/+12
|
* Simplify conditionalCarlos Antonio da Silva2014-07-311-3/+2
|
* Push options check up so we can simplify internal methodsCarlos Antonio da Silva2014-07-311-13/+10
|
* use a strategy object for generating urls in named helpersAaron Patterson2014-07-171-8/+13
| | | | | | 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.
* extract path building to a methodAaron Patterson2014-07-161-9/+11
|
* break out path building logic to methodsAaron Patterson2014-07-161-14/+22
|
* only extract :params from the options hash onceAaron Patterson2014-07-161-3/+2
|
* push host / port / protocol extraction upAaron Patterson2014-06-301-6/+6
| | | | Then we only need to extract host once.
* add both branches to the only_path conditionalAaron Patterson2014-06-191-6/+6
|
* only check named_host? once in normalize_hostAaron Patterson2014-06-121-3/+7
|
* lookup subdomain from the options hash once, defaulting to trueAaron Patterson2014-06-121-2/+2
| | | | | if the subdomain wasn't specified, it's the same as if specifying :subdomain as `true`, so we can default the value to `true` safely.
* only extract domain from the options hash onceAaron Patterson2014-06-121-3/+4
|
* reduce calls to `named_host?`Aaron Patterson2014-06-121-2/+6
| | | | | `normalize_host` already calls `named_host?`, so there is no reason to test `named_host?` again in the `extract_domain` method.
* Removed warning actionpack url.rbJuanito Fatas2014-06-121-2/+2
| | | | | | | | | | Before: /Users/Juan/dev/rails/actionpack/lib/action_dispatch/http/url.rb:95: warning: shadowing outer local variable - port After: No warning
* remove useless to_param callAaron Patterson2014-06-111-1/+1
| | | | | extract_subdomain always returns a string, and to_param calls to_s on a string
* only look up the subdomain onceAaron Patterson2014-06-111-3/+4
|
* scheme should contain one or more charactersAaron Patterson2014-06-111-1/+1
|
* pull the port out of the options hash onceAaron Patterson2014-06-111-2/+3
|
* remove useless nil checkAaron Patterson2014-06-111-2/+2
| | | | | | | | | irb(main):004:0> /foo/ !~ nil => true irb(main):005:0> /foo/ !~ 'bar' => true irb(main):006:0> /foo/ !~ 'foo' => false
* these methods are always called with a tld_parameterAaron Patterson2014-06-111-3/+3
| | | | | remove the default parameter since the methods are always called with a parameter
* rm `same_host?`. The same conditional is two lines down.Aaron Patterson2014-06-111-5/+3
|
* Revert "rm `same_host?`. The same conditional is two lines down."Aaron Patterson2014-06-111-5/+8
| | | | This reverts commit 79469b4b0c05a50e19699bc9b568042add2d4987.
* rm `same_host?`. The same conditional is two lines down.Aaron Patterson2014-06-111-8/+5
|
* cache host on the stack so we only look it up onceAaron Patterson2014-06-111-8/+9
|
* only pull :protocol from the options hash onceAaron Patterson2014-06-111-2/+3
|
* cache protocol on the stack to reduce options hash lookupsAaron Patterson2014-06-111-7/+7
|
* eliminate nil checks in normalize_portAaron Patterson2014-06-111-7/+7
|
* reduce hash lookups and disconnect normalize_port from the options hashAaron Patterson2014-06-111-9/+9
|
* Merge pull request #14986 from dlangevin/trailing-slash-url-generationRafael Mendonça França2014-05-241-7/+13
|\ | | | | | | | | | | | | Fixes URL generation with trailing_slash: true Conflicts: actionpack/lib/action_dispatch/http/url.rb
| * Fixes URL generation with trailing_slash: trueDan Langevin2014-05-221-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | URL generation with trailing_slash: true was adding a trailing slash after .:format Routes.draw do resources :bars end bars_url(trailing_slash: true, format: 'json') # => /bars.json/ This commit removes that extra trailing slash
* | fewer string allocations per url_forAaron Patterson2014-05-201-7/+5
| |
* | mutate the path string to avoid object allocationsAaron Patterson2014-05-201-4/+4
| |
* | push only_path conditional upAaron Patterson2014-05-201-18/+19
| |
* | push arg checking upAaron Patterson2014-05-201-4/+4
| |
* | fewer method calls and string garbage when there is no user/passwordAaron Patterson2014-05-201-9/+5
| |
* | Always use the provided port for protocol relative urlsAndrew White2014-05-111-0/+2
| | | | | | | | | | There may be situations where you need to tunnel SSL connections over port 80 so we shouldn't remove it if it has been explicitly provided.
* | ActionDispatch::Http::URL.normalize_port should not strip port for protocol ↵Guilherme Cavalcanti2014-05-111-2/+0
| | | | | | | | relative URL.
* | skip dealing with params if none are providedAaron Patterson2014-05-091-4/+11
| | | | | | | | | | | | | | | | | | | | | | This lets us avoid 1. A slow call to Hash#slice 2. An is_a? test 3. Extra hash allocations (from slice) 4. String allocations etc.
* | don't mutate the options hash, so we don't have to dupAaron Patterson2014-05-091-4/+3
| | | | | | | | avoids extra hash allocations on each call
* | use unless and || since these options are booleanAaron Patterson2014-05-091-1/+1
|/
* Refactor ActionDispatch::Http::URL.build_host_urlAndrew White2013-04-181-20/+49
| | | | | Add support for extracting the port from the :host option and for removing the subdomain by using nil, false or ''.
* Duplicate options before mutating themAndrew White2013-04-181-0/+1
|
* Passing subdomain: '' to url_for removes the subdomain (instead of adding a ↵Derek Watson2013-04-181-1/+1
| | | | | | leading .) Adding a boolean route constraint checks for presence/absence of request property
* Fix improperly configured host in generated urlsschneems2013-03-191-1/+12
| | | | | | | | | | | | | | | | | | | If the host in `default_url_options` is accidentally set with a protocol such as ``` host: "http://example.com" ``` then the generated url will have the protocol twice `http://http://example.com` which is not what the user intended. Likely they wanted to define a host `host: "example.com"` and a `protocol: "http://"` but did not know the convention. This may not the most common problem, but when it happens it can go undetected for a while. I accidentally added `http://` out of habit recently only to find all the links in my emails were broken after deploying a demo site to production. Rather than allow this accident go undetected, we can fix the problem in line by properly setting the protocol and host. I was able to find this related question on stack overflow: http://stackoverflow.com/questions/5878329/rails-3-devise-how-do-i-make-the-email-confirmation-links-use-secure-https-n where the answer was highly upvoted. This is based off of work in #7415 cc/ @pixeltrix ATP Action Mailer and Action Pack
* Require AS deps in ActionDispatch::Http::URLMiha Filej2013-02-191-0/+3
| | | | Allows us to use url_for and friends in isolation.