在rails app中的另一个窗口中打开的社交网站链接

时间:2016-09-27 05:00:37

标签: ruby-on-rails

如何在rails app中实现社交网站链接。实际上我做了以下事情:

<%= link_to "www.linkedin.com/in/raj4057kumar", :target => "_blank", class: "linkedin" do %>
  <%= image_tag("linkedin.png", :alt => "Linkedin") %>
<% end %>

但问题是:

网址为:http://localhost:3000/www.linkedin.com/in/raj4057kumar 我们需要的是:www.linkedin.com/in/raj4057kumar

怎么做???

2 个答案:

答案 0 :(得分:1)

因为你没有在网址的前面添加http://

将您的代码更改为:

<%= link_to "LINK NAME HERE", "http://www.linkedin.com/in/raj4057kumar", :target => "_blank", class: "linkedin" do %> 
<%= image_tag("linkedin.png", :alt => "Linkedin") %> 
<% end %>

答案 1 :(得分:1)

尝试在外部网址

的开头插入https://
<%= link_to 'Raj Kumar', 'https://www.linkedin.com/in/raj4057kumar', target: '_blank', class: 'linkedin' %>