简体   繁体   中英

ActionView::Template::Error on Rails

I'm learning ror and currently following a tutorial to build a todo app. After updating the new.js.erb file I get the error below. It seems to be a "simple" syntax error but I just can't see what the problem actually is?

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)

Any pointers?

Try to replace with:

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

simple_form_for_task seems to be a typo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM