HAML形式很奇怪

时间:2011-04-13 14:27:52

标签: ruby-on-rails forms haml

-form_tag(search_path, :method => :get)
  = label_tag("Place")
  = text_field_tag("place", nil, :id => "place")
  = text_field_tag("near", nil, :id => "near")
  = submit_tag("Search", :id => "search", :name => "search", :class => "form_submit", :disabled => false, :disable_with => "Please wait...")

我有上面的代码,它返回以下错误:

/app/app/views/venues/main.haml:7: syntax error, unexpected kENSURE, expecting $end

我的申请模板如下:

%html
  %head
    %title
      WhosHere
    = stylesheet_link_tag :all
    = javascript_include_tag 'http://code.jquery.com/jquery-1.5.2.min.js'
    = csrf_meta_tag
  %body
    = yield

1 个答案:

答案 0 :(得分:4)

也许你应该在form_tag的末尾有一个“do”,以便系统知道你想将一个块传递给form_tag?

- form_tag(search_path, :method => :get) do
  ...