Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.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
Ruby on rails 区别于<;%=&引用;及<;%&引用;当ruby与html混合时?_Ruby On Rails_Ruby - Fatal编程技术网

Ruby on rails 区别于<;%=&引用;及<;%&引用;当ruby与html混合时?

Ruby on rails 区别于<;%=&引用;及<;%&引用;当ruby与html混合时?,ruby-on-rails,ruby,Ruby On Rails,Ruby,我正在学习Rails,我正在做一个练习,我必须在视图文件中混合一些html和ruby 在编写ruby时,“”和“”之间的主要区别是什么?将计算并显示结果。 在这种情况下,您应该在视图中看到3 <%= something which you would like to have displayed in your view %> <% something you would like to have hidden, (or something which doesn't dis

我正在学习Rails,我正在做一个练习,我必须在视图文件中混合一些html和ruby

在编写ruby时,“”和“”之间的主要区别是什么?

将计算并显示结果。 在这种情况下,您应该在视图中看到3

<%= something which you would like to have displayed in your view %>
<% something you would like to have hidden, 
(or something which doesn't display anything in the view) such as a
 conditional statement %>

<% if @post.nil? %>
    <%= render "nilNotify" %>
<% else %>
    <%= @post.content %>
<% end %>
将进行计算,但不会在视图中显示结果。在这种情况下,您将不会在视图中看到3。

将计算并显示结果。
<%= something which you would like to have displayed in your view %>
<% something you would like to have hidden, 
(or something which doesn't display anything in the view) such as a
 conditional statement %>

<% if @post.nil? %>
    <%= render "nilNotify" %>
<% else %>
    <%= @post.content %>
<% end %>
在这种情况下,您应该在视图中看到3

<%= something which you would like to have displayed in your view %>
<% something you would like to have hidden, 
(or something which doesn't display anything in the view) such as a
 conditional statement %>

<% if @post.nil? %>
    <%= render "nilNotify" %>
<% else %>
    <%= @post.content %>
<% end %>
将进行计算,但不会在视图中显示结果。在这种情况下,您将不会在视图中看到3。


<%= something which you would like to have displayed in your view %>
<% something you would like to have hidden, 
(or something which doesn't display anything in the view) such as a
 conditional statement %>

<% if @post.nil? %>
    <%= render "nilNotify" %>
<% else %>
    <%= @post.content %>
<% end %>


您可以添加即使使用
也要显示的内容,也可以添加即使使用
也要显示的内容