HAML form for rails

I am currently trying to convert an ERB layout to HAML.

This is the error I get:

index.html.haml:18: syntax error, unexpected ')' ));}\n #{_hamlout.format_... 

Here is the HAML page:

 .row-fluid .span6 %h2 Todo List .span6 %h2{:style => "text-align:right;"} <script>document.write(today)</script> %hr.divider .row-fluid .span6 %h2.small_head New Task = render :partial => 'layouts/form_errors', :locals => {:object => @list} .form = form_for :list, :url => {:controller => 'lists', :action => 'create'} do |f| = label_tag :list_name, "Title", :class => 'header_label' 

I also tried this as an option:

 = form_for(:list, :url => {:controller => 'lists', :action => 'create'}) do |f| = label_tag(:list_name, "Title", :class => 'header_label') 

None of them work, and both generate the same error message, and help to get a high score.

+4
source share
1 answer

You need to put the code in the do block. This should work:

 = form_for :list, :url => {:controller => 'lists', :action => 'create'} do |f| = label_tag :list_name, "Title", :class => 'header_label' 
+13
source

Source: https://habr.com/ru/post/1479642/


All Articles