Raidspec Raidspec - 4 months ago 15
Ruby Question

Rails creating links to external sites with <%= link_to %>

Is it possible to send a user to a website such as www.facebook.com with a rails tag?

I tried:

<%= link_to www.facebook.com %>.

Answer

Yes,

http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to

<%= link_to 'facebook', 'https://www.facebook.com' %>