Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML<;a>;标记为Ruby?_Html_Ruby On Rails_Ruby - Fatal编程技术网

HTML<;a>;标记为Ruby?

HTML<;a>;标记为Ruby?,html,ruby-on-rails,ruby,Html,Ruby On Rails,Ruby,我认为有一个相对简单的答案,但我如何才能将此链接链接到: <%= link_to(image_tag(p.thumbnail, class: "hoi"), "Something in here?") %> …与此相同的链接: <a class="fg" href="#<%= p.id %>" data-toggle="modal"> ? (为了清楚起见:当我单击链接到的中的图像时,我想使用数据切换=“modal”选项链接到href=“#”。尝试以

我认为有一个相对简单的答案,但我如何才能将此链接链接到:

<%= link_to(image_tag(p.thumbnail, class: "hoi"), "Something in here?") %>

…与此相同的链接:

<a class="fg" href="#<%= p.id %>" data-toggle="modal">

?


(为了清楚起见:当我单击链接到的
中的图像时,我想使用
数据切换=“modal”
选项链接到
href=“#”

尝试以下操作:

<%= link_to "##{p.id}", "Something in here?", :class => "fg", :data-toggle => "modal" %>
“fg”,:数据切换=>“模式”%>

如果您试图将图像链接到页面上的定位点,请执行以下操作:

<%= link_to(image_tag(p.thumbnail, class: "hoi"), "##{p.id}") %>


你可以在erb块内进行普通的ruby字符串插值(

你想把
#“
作为href元素的值吗?呵呵,我现在看到了(我试着把这个
#
放在
块内,这就是我没有做的原因)。谢谢!我最终得到了这个:
“modal”)>`