Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HAML Form For Rails

I'm currently trying to convert an ERB layout to HAML.

This is the error I keep receiving:

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 have also tried this as a variation:

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

Neither work and both generate the same error message, and help greatly appreciated.

like image 510
James Parker Avatar asked May 07 '13 23:05

James Parker


1 Answers

You need to indent 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' 
like image 72
Chris Salzberg Avatar answered Oct 14 '22 05:10

Chris Salzberg