View 嵌入的Ruby没有被插值
不知道为什么这条线不工作 控制器View 嵌入的Ruby没有被插值,view,ruby-on-rails-4,erb,View,Ruby On Rails 4,Erb,不知道为什么这条线不工作 控制器 @images = { "Example1" => "ExampleA", "Example2" => "ExampleB", } 看法 当我查看输出时,不知何故,为背景图像呈现的HTML是: <div class="fill" style="background-image: url(/#{image}.jpg);"> 一般来说,我的理解是插值标记,插值使用双引号,而不是单引号 改变 style=“背景图像:
@images = {
"Example1" => "ExampleA",
"Example2" => "ExampleB",
}
看法
当我查看输出时,不知何故,为背景图像呈现的HTML是:
<div class="fill" style="background-image: url(/#{image}.jpg);">
一般来说,我的理解是插值标记,插值使用双引号,而不是单引号 改变
style=“背景图像:url();”
到
style='background-image:url();'代码>
或
style=“背景图像:url(.jpg);”
<div class="fill" style="background-image: url(/#{image}.jpg);">