Rails上的ActionView :: Template :: Error

时间:2014-01-25 14:34:06

标签: ruby-on-rails ruby-on-rails-4 actionview

我正在学习ror,目前正在学习构建todo应用程序的教程。更新new.js.erb文件后,我收到以下错误。这似乎是一个“简单”的语法错误,但我只是看不出问题究竟是什么?

Completed 500 Internal Server Error in 14ms

ActionView::Template::Error (/todo/app/views/tasks/_task_form.html.haml:3: syntax error, unexpected tLABEL
haml_temp =  simple_form_for_task, class: 'clearfix' do |f|
                                     ^
/todo/app/views/tasks/_task_form.html.haml:3: syntax error, unexpected keyword_do, expecting keyword_end
haml_temp =  simple_form_for_task, class: 'clearfix' do |f|
                                                   ^
/todo/app/views/tasks/_task_form.html.haml:11: syntax error, unexpected keyword_ensure, expecting end-of-input):
    1: .modal-header
    2:     %h1 New Task
    3: = simple_form_for_task, class: 'clearfix' do |f|
    4:     .modal-body
    5:         = f.input :title
    6:         = f.input :note
  app/views/tasks/new.js.erb:2:in `_app_views_tasks_new_js_erb___4248753827628901371_70187720231200'


  Rendered /.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.2ms)
  Rendered /.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
  Rendered /.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (12.5ms)

任何指针?

1 个答案:

答案 0 :(得分:2)

尝试替换为:

= simple_form_for task, class: 'clearfix' do |f|

simple_form_for_task似乎是一个错字