HAML如何识别块的结尾? [英] How HAML can recognize the end of the block?
本文介绍了HAML如何识别块的结尾?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
= form_for(:subject, :url => {:action => "create"}) do |f|
= render :partial => "form", :locals => {:f => f}
#form_buttons= submit_tag "Create Subject"
注意到form_for有一个"do",所以它需要一个"end",但是HAML如何知道在哪里结束"end"?
Noticed that form_for has a "do",so it needs a "end", but how does HAML knows where to end the "end" ?
对不起,我的英语,希望您能理解我在说什么!
Sorry about my English,hope you can understand what am I talking about!
推荐答案
HAML使用缩进来定界块,就像Python语言一样.也许您应该阅读基本的教程或
HAML uses indentation to delimit blocks in the same way the Python language does. Perhaps you should read a basic tutorial or WIKI for more information.
= form_for(:subject, :url => {:action => "create"}) do |f|
= render :partial => "form", :locals => {:f => f}
#you can use f here
# you can't use f here
这篇关于HAML如何识别块的结尾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文