Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>haml is all about indentation. The actual usage of rails helpers etc doesn't change at all. When you indent a line by 2 spaces, it is understood that your indented section is contained <em>within</em> the previous line that was non-indented. Thus this:</p> <pre><code>%ul#hello %li My List Item </code></pre> <p>Becomes this:</p> <pre><code>&lt;ul id='hello'&gt; &lt;li&gt;My List Item&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>This applies to <code>do</code> blocks also. If you have a rails helper you need to indent the block of the helper just as you would the rest of the markup. Haml will automatically add the <code>end</code> when the indentation ends. You should change your markup to look like this, I've added some comments for clarity:</p> <pre><code>= form_for :booking, :url =&gt; booking_path(@booking), :html =&gt; { :method =&gt; :put } do |form| %ul - @booking.errors.full_messages.each do |msg| -# This is looking good so far... correct indent inside this `do` block %li= msg -# I don't feel like we are in the error messages block anymore, but you were still indented here. I've removed the indentation to indicate that we are no longer in that block. -# This will work fine, but is there a reason you didn't use `form.label :status` here? = label :booking, :status = form.text_field :status -# I've changed this to use `= form.` because I believe the other version (-) is deprecated = form.fields_for :user do |user_form| -# You didn't have this indented correctly. To be part of the do block you need to indent it appropriately. Fixed. = user_form.label :fullname = user_form.text_field :fullname -# This is no longer part of the `fields_for` call, so I have removed the indentation again to indicate that this is part of the outer section. = form.submit "Update this booking" </code></pre> <p>Hopefully this was helpful :) Haml might feel a little awkward at first but I have found that it greatly assists development speeds and to me is MUCH easier to read and write. Took me about a week but it grew on me and now I'll never look back :p</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload