Haml is beautiful, but I've discovered what appear to be two more
little bugs related to Rails' form_for helper.  Details follow.  The
environment here is Rails 1.2.1 and a relatively recent (1.4.1?) pull
of haml from the trunk.

-- Jeff

My Rails haml template has a textarea in a form_for tag.  The text
area contains two lines of text separated by two CR's, like this:

One sentence.

Followed by another.

I submitted the form and saved the contents of the textarea to the
database.  But when I viewed the saved text in the form again, it was
mangled: haml added a bunch of whitespace characters after the last
CR, before the second sentence, like this:

One sentence.

                          Followed by another.

In a textarea, extra whitespace is significant and should not be
introduced.  The whitespace is not in the database.  And in a haml-
less world, the problem goes away.  I verified this by deleting the
haml plugin and going back to rhtml.

Before deleting the haml plugin, I renamed my haml templates to expose
the rhtml templates.  And I discovered another little problem: haml
ended the rhtml form_for tag way too early.  This rhtml:

  <% form_for(:post, @post, :url => site_posts_path, :html =>
@html_form_attributes) do |f|%>
    ...labels and fields here...
  <% end %>

Resulted in this html when processed at run-time by haml:

<form action="/sites/2/posts" method="post"><div style="margin:
0;padding:0"><input name="_method" type="hidden" value="put" /></div>
</form> ...labels and fields here...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to