当我按下我的新任务时,我在rails服务器上收到以下错误。我的应用上的按钮:
Processing by TasksController#new as JS
ERROR: compiling _app_views_tasks__task_form_html_haml__3289363938348847619_70231363971640 RAISED /app/views/tasks/_task_form.html.haml:4: syntax error, unexpected ')'
));}\n</div>\n<div class='modal-body'>\n #{
^
/app/views/tasks/_task_form.html.haml:8: unknown regexp options - dv
/app/views/tasks/_task_form.html.haml:8: syntax error, unexpected $undefined
));}\n</div>\n<div class='modal-footer'>\n #{
^
/app/views/tasks/_task_form.html.haml:8: syntax error, unexpected keyword_class, expecting keyword_do or '{' or '('
));}\n</div>\n<div class='modal-footer'>\n #{
^
/app/views/tasks/_task_form.html.haml:8: syntax error, unexpected $undefined
));}\n</div>\n<div class='modal-footer'>\n #{
^
/app/views/tasks/_task_form.html.haml:10: syntax error, unexpected '}', expecting keyword_end
));}\n</div>\n", -1, false);::Ham...
^
以下是_task_form_html_haml
上的代码:
.modal-header
%h1 New Task
= simple_form_for task, class: 'clearfix' do |f|
.modal-body
= f.input :title
= f.input :note
= f.input :completed
.modal-footer
= f.submit 'Save', class: 'btn btn-primary'
我试图找到更多关于编译错误,偏见,haml的信息,但到目前为止还没有运气。有人能指出我正确的方向吗?
答案 0 :(得分:0)
你有这一行:
= simple_form_for task, class: 'clearfix' do |f|
看起来像是在打开一个区块,但是在它下方没有任何缩进成为区块内容。
您只需要正确缩进代码:
.modal-header
%h1 New Task
= simple_form_for task, class: 'clearfix' do |f|
.modal-body
= f.input :title
= f.input :note
= f.input :completed
.modal-footer
= f.submit 'Save', class: 'btn btn-primary'