Forum: Ruby on Rails link_to helper not reaching 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.
C3653e414c14625e3eaa5ce3a55ad975?d=identicon&s=25 Michelle Langendoen (mlbagel)
on 2016-08-11 16:34
Attachment: _form.erb (2 KB)
Attachment: pins_controller.rb (827 Bytes)
RoR newbie and working on a pinning app similar to pinterest.
In my form_for helper  I  try to link_to an external web page
<%= link_to @pin.url, "http://#{@pin.url}" %> but I get
No route matches [GET] "/www.xxx.com"
and the server is trying to reach
http://localhost:3000/www.xxx.com

I can't seem to get rid of the local call.
I've attached both my partial form view for create and update, and the
controller file as well.
Would appreciate a FULL answer.  My online course instructor is useless
and keeps giving me the same answer as I typed above but 'duh' already
did that, now what???
B896fce62a47fc4bce2dbd9ed7a26eb2?d=identicon&s=25 Ben Toogood (ben-toogood)
on 2016-08-30 17:41
Hey Michelle,

Checkout the URL Helpers Reference:
http://api.rubyonrails.org/classes/ActionView/Help...

Alternatively, I'd suggest just using an <a> tag and setting the href
attribute to the link.

Hope this helps

Ben
This topic is locked and can not be replied to.