I formerly had this in a template:
<h2 class="card-title"><%= link_to(@post.name,
@post.url, target: '_blank') %></h2>
I now need to send a request (GET is fine) to the server and open @post.url in a new window/tab. I changed the template code to:
<h2 class="card-title"> <%= link_to(@post.name, url_for(:post, :read, id: @post.id) %></h2>
and the server code:
get :read, '/post/:id/read' do
post = Post.with_pk! params[:id]
post.click!
post.save(changed: true)
redirect post.url, target: '_blank'
end
This opens @post.url in the same tab/window. How do I get it opened in a separate window?
TIA,
Jeffrey