【问题标题】:Haml: syntax error, unexpected keyword_ensure, expecting end-of-inputHaml:语法错误,意外的keyword_ensure,期望输入结束
【发布时间】:2016-07-04 12:24:35
【问题描述】:

在我的项目中,我使用haml 对视图进行编码,在这部分中,服务器显示syntax error, unexpected keyword_ensure, expecting end-of-input 错误:

.col-xs-12#new_posts_form 
  %h2= "New posts"
  = form_tag admin_articles_posts_path
    - @posts.each_with_index do |post,i|
      = fields_for "posts[#{i}]", post do |f| 
        .col-xs-12
          %label Content
          = f.text_area :content, placeholder: "Content", class: "form-control"
        .col-xs-12
          %label Publishing date
          =f.date_field :start_date, placeholder: "yyyy-mm-dd", class: "form-control"
        .col-xs-12
          = f.submit "Next", class: "btn btn-default"

错误点第 13 行,最后一行。

【问题讨论】:

  • 我认为缺少“do” = form_tag admin_articles_posts_path
  • 是的,就是这样!你能写一个答案来选择它吗?

标签: ruby-on-rails ruby haml


【解决方案1】:

我认为正确的语法是

= form_tag admin_articles_posts_path do 

【讨论】:

    猜你喜欢
    • 2015-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多