The following does not open a new tab. Instead it opens on the current tab:
link_to ... :method => :post, :target => '_blank'
HTML returns:
<a target="_blank" rel="nofollow" data-method="post" href="/foobar/videos/abc/buy">Foobar</a>
I hear you can’t post to a new window with Rails helpers. Until I read this:
https://github.com/rails/rails/issues/2885 (posted 4 months ago though).
A workaround would also be appreciated. However, more importantly I am looking for a reason why it is behaving the way it is.
It appears to be fixed in https://github.com/rails/jquery-ujs/commit/888be8adcb7d609f442b3883dc722.
“jquery-ujs” is distributed as part of the “jquery-rails” gem.
Try to
bundle update jquery-railsitself to the latest version (which is 2.1.1).