Ruby on rails 区别于<;%=&引用;及<;%&引用;当ruby与html混合时?
我正在学习Rails,我正在做一个练习,我必须在视图文件中混合一些html和ruby 在编写ruby时,“”和“”之间的主要区别是什么?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
将计算并显示结果。
在这种情况下,您应该在视图中看到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 %>
您可以添加即使使用也要显示的内容,也可以添加即使使用也要显示的内容