When using link_to in Rails, I wanted to display it in a separate tab, so I implemented it, so I will leave it as a memo.
First, specify the character string to be displayed and the link destination URL with
<%= link_to "String", "Link URL" %>
target:: _ blank to display in a separate tab
<%= link_to "String", "Link URL", target: :_blank %>
Now you can open it in another tab. However, this has problems in terms of performance and security. .. ..
-Google engineer warns, "Open in another tab" link is actually dangerous! ?? [Summary of SEO information] -Is it really dangerous? Dangerous "Open in another tab (target =" _ blank ")"
To avoid this problem, add
rel =" noopener noreferrer ".
<%= link_to "String", "Link URL", target: :_blank, rel: "noopener noreferrer" %>
Now you can open another tab with confidence.