# \[PATCH\] Automatically set :only\_path option to false when :h

**URL:** <https://www.ruby-forum.com/t/patch-automatically-set-only-path-option-to-false-when-h/114912>\
**Category:** Rails\
**Created:** [September 18, 2007, 7:17pm UTC](https://www.ruby-forum.com/t/patch-automatically-set-only-path-option-to-false-when-h/114912 "2007-09-18T19:17:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kayros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kayros](https://www.ruby-forum.com/u/kayros)\
**Post date:** [September 18, 2007, 7:17pm UTC](https://www.ruby-forum.com/t/patch-automatically-set-only-path-option-to-false-when-h/114912/1 "2007-09-18T19:17:15Z")

</div>

Hello,

I’ve just posted a patch to the Trac. It intends to simplify the use  
of url helpers such as link\_to when you use the :host option.  
When you’re using a helper such as link\_to and that you provide  
a :host option to it, it’s not use by default, you have to  
set :only\_path to false too to enable it (to have the full URL, not  
the relative one).

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](http://www.example.com)’, :only\_path =\> false}))

and now you can do :

link\_to(‘Test Link’, {:controller =\> ‘weblog’, :action =\>  
‘show’, :host =\> ‘[www.example.com](http://www.example.com)’}))

to get the same result.

This patch is available at : [http://dev.rubyonrails.org/ticket/9586](http://dev.rubyonrails.org/ticket/9586)

Have a good day.

–

Nicolas C.

> **[Bounga’s Home](https://www.bounga.org/)**
>
> Thoughts about Ruby, Rails, Hanami, Elixir, Phoenix, Javascript and Unix.

> **[Nicolas Cavigneaux Resume](https://www.cavigneaux.net/)**
>
> Nicolas Cavigneaux Resume
