嵌入式红宝石语法“<%= ..%>”在铁轨上 [英] embedded ruby syntax "<%= .. %>" in rails
本文介绍了嵌入式红宝石语法“<%= ..%>”在铁轨上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对以下有关ERB模板的想法正确吗?任何建议将不胜感激。
Am I correct with the idea below regarding ERB template? any advice would be really appreciated.
嵌入的红宝石语法是否带有等号<%=%>以呈现某些输出?而没有等号<%%>的人则没有。
Is the embedded ruby syntax with an equal sign "<%= %>" intended to render some output? while the one without the equal sign "<% %>" doesn't.
推荐答案
使用<%=%>
时,表达式值输出到您的输出。尽管<%%>
只是编写一些不会呈现到最终输出的 Ruby 代码。
When you use <%= %>
you render the expression value to your output. While <% %>
is simply to write some Ruby code that won't be rendered to final output.
这篇关于嵌入式红宝石语法“<%= ..%>”在铁轨上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文