Forum: Ruby on Rails link_to external link

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.
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2006-04-24 17:27
(Received via mailing list)
I have searched through the api several times through and can't seem to
find this.

<%= link_to 'Help',
 {:url => 'https://www.example.com/page?AppServeHelp'},
 {:target => "_new"} %>

but this doesn't work as it still prepends the current server/controller
space on the url itself.

How do I accomplish this?

Thanks

Craig
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Kevin Olbrich (Guest)
on 2006-04-24 17:37
(Received via mailing list)
try

link_to 'Help','https://www.example.com/page?AppServeHelp',{:target =>
"_new"}

On Monday, April 24, 2006, at 8:26 AM, Craig White wrote:
>How do I accomplish this?
>
>Thanks
>
>Craig
>
>_______________________________________________
>Rails mailing list
>Rails@lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails


_Kevin
43ec5998360a0cc21b51afef1781e9c0?d=identicon&s=25 Daniel Higginbotham (Guest)
on 2006-04-24 19:17
(Received via mailing list)
Hi Craig,

I'm not sure that you'd want to use link_to in this case. It seems like
the
purpose of link_to and url_for, which it's based on, is to take
advantage of
the mappings you've created in routes.rb .

However, you may also want to try the following options, which I copied
from
the url_for documentation

# :only_path - if true, returns the absolute URL (omitting the protocol,
host name, and port)
# :host - overrides the default (current) host if provided
# :protocol - overrides the default (current) protocol if provided

I hope this helps!
Daniel
This topic is locked and can not be replied to.