If you have whitespace-sensitive tags, such as textarea, and you don't want Haml to mess with the whitespace, use the "~" command. For instance, with form_for:
- form_for(:post, @post, :url => site_posts_path, :html => @html_form_attributes) do |f| ~ text_area :post, :content As to your second question, I don't understand what you mean by RHTML being processed by Haml... the Haml extensions to ActionView shouldn't be loaded at all when parsing RHTML unless you include a Haml partial some time earlier in the template, and even then I'm unable to reproduce your result. Can you show me your exact code? - Nathan Jeff wrote: > 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 -~----------~----~----~----~------~----~------~--~---
