Forum: Ruby on Rails Link_to :protocol and :host?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A7db9ec803b5895ae5f916a74e2db329?d=identicon&s=25 lists (Guest)
on 2005-11-13 18:43
(Received via mailing list)
Hello,

I am trying to set the protocol and host in link_to based on the
documentation.

I have the following:

<%= link_to "View Cart", {:controller => 'store', :action =>
'view_cart',
:protocol => 'https://', :host => 'secure.host.com'} %>

I would expect this to generate a https link to another host.

Instead, all I get is:

<a href="/store/view_cart">View Cart</a>

Have I misunderstood the url_for specs?

Thanks,
Hunter
9b13522e3b75d56c2949a5030eaaff70?d=identicon&s=25 johans (Guest)
on 2005-11-13 19:11
(Received via mailing list)
Hi,

On 11/13/05, Hunter Hillegas <lists@lastonepicked.com> wrote:
> <%= link_to "View Cart", {:controller => 'store', :action => 'view_cart',
> :protocol => 'https://', :host => 'secure.host.com'} %>
>
> I would expect this to generate a https link to another host.
>
> Instead, all I get is:
>
> <a href="/store/view_cart">View Cart</a>

link_to "View Cart", {:controller => 'store', :action => 'view_cart',
:protocol => 'https://', :host => 'secure.host.com', :only_path =>
false}

:only_path is true by default in the scope of ActionView::Helpers (eg.
all views), so :protocol and :host will have no effect unless
:only_path=>false is forced.

Cheers,
JS

--
http://johansorensen.com
http://theexciter.com
A7db9ec803b5895ae5f916a74e2db329?d=identicon&s=25 lists (Guest)
on 2005-11-13 22:41
(Received via mailing list)
Thanks.

Perhaps a bug should be filed on the documentation? I don't think this
is
mentioned anywhere.
This topic is locked and can not be replied to.