embedded ruby syntax “<%= .. %>” in rails [duplicate]

落花浮王杯 提交于 2019-12-20 03:09:25

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/8110997/embedded-ruby-syntax-in-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!