Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9586 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] Automatically set :only_path option to false when :host option is specified in url helpers

Reported by: Bounga Assigned to: core
Priority: normal Milestone: 1.x
Component: ActionPack Version: edge
Severity: normal Keywords: tiny url_helper
Cc:

Description

When you're using a helper such as link_to and that you provide a :host option to it, it is not use by default, you have to set :only_path to false too to enable it.

This tiny patch remedies this. Now when you specified the :host option, the :only_path option is automatically set to false.

Before this patch you had to do : link_to('Test Link', {:controller => 'weblog', :action => 'show', :host => 'www.example.com', :only_path => false}))

and now you can do : link_to('Test Link', {:controller => 'weblog', :action => 'show', :host => 'www.example.com'}))

to have the same result.

Attachments

set_only_path_to_false_if_host_is_specified_for_url_helpers.diff (3.4 kB) - added by Bounga on 09/18/07 13:44:07.
patch to enhance url helpers when using :host option

Change History

09/18/07 13:44:07 changed by Bounga

  • attachment set_only_path_to_false_if_host_is_specified_for_url_helpers.diff added.

patch to enhance url helpers when using :host option

09/18/07 13:47:42 changed by Bounga

  • type changed from defect to enhancement.

09/22/07 17:19:34 changed by david

  • status changed from new to closed.
  • resolution set to fixed.

(In [7542]) Fixed that setting the :host option in url_for would automatically turn off :only_path (since :host would otherwise not be shown) (closes #9586) [Bounga]