在HTML中,如果我想在新窗口中打开链接,我会采用target ="_ blank",如下所示:
<a href="http://www.website.com/" target="_blank"><img src="/img.png" /></a>
Run Code Online (Sandbox Code Playgroud)
如何将"_blank"添加到rails?这是我到目前为止链接的代码(但它当前在相同的选项卡/窗口中打开):
<%= link_to image_tag("img.png"), 'http://www.website.com/' %>
Run Code Online (Sandbox Code Playgroud) 我在同一个主题(这里是一个)上发现了一些帖子,并认为我做了正确的更改,但我仍然无法解决问题.
完成捆绑安装后,我推送到heroku,当它到达sqlite3安装时出现以下错误.
Installing sqlite3 (1.3.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may …Run Code Online (Sandbox Code Playgroud) 我最近问了一个关于在新页面中打开链接的问题(继续链接).我发现有两个答案.
:target => '_blank'
target: "_blank"
Run Code Online (Sandbox Code Playgroud)
我希望有人可以解释单引号和双引号之间的区别以及为什么上述两种方法都有效.我理解第二个选项只能在更新版本的rails上实现(我使用的是3.2.2).