Search code examples
htmlruby-on-railslink-to

Rails: Open link in a new page


I was wondering a way to open a link in a new tab. Here is the code I have so far:

<li><%= link_to "Pictures", pictures_path  %></li>

I have researched ways to do this with target="_blank", but for some reason when I tried it, it did not work. Any help is greatly appreciated!


Solution

  • Try it like this:

    <li><%= link_to "Pictures", pictures_path, target: :_blank %></li>