The form_tag, and thus form_for, helper in Rails 1.2 works differently
than it does in 1.1. It magically adds the HTML to the page without you
having to output it. That means that if you /do/ output it, using the
"=" operator in Haml or "<%=" in ERB, you end up with a duplicate. Thus,
the code you want is:
%h1 Editing order
= error_messages_for :order
- form_for(:order, :url => order_path(@order), :html => { :method =>
:put }) do |f|
%p= submit_tag "Update"
%p
= link_to 'Show', order_path(@order)
|
= link_to 'Back', orders_path
Notice the hyphen instead of the equals sign.
- Nathan
shaners o matic 8000 wrote:
> i converted the application layout as a practice. it went fine. next i
> did the edit template thats generated as a part of the
> scaffold_resource. i ended up with this haml:
>
> <pre>
> %h1 Editing order
>
> = error_messages_for :order
>
> = form_for(:order, :url => order_path(@order), :html => { :method =>
> :put }) do |f|
> %p= submit_tag "Update"
>
> %p
> = link_to 'Show', order_path(@order)
> |
> = link_to 'Back', orders_path
> </pre>
>
> all of it is fine and working except the form which appears on the
> compiled page twice:
>
> <pre>
> <form action="/orders/2" method="post"><div
> style="margin:0;padding:0"><input name="_method" type="hidden"
> value="put" /></div><p>
> <input name="commit" type="submit" value="Update" />
> </p>
> </form><h1>Editing order</h1>
>
> <form action="/orders/2" method="post"><div
> style="margin:0;padding:0"><input name="_method" type="hidden"
> value="put" /></div><p>
> <input name="commit" type="submit" value="Update" />
> </p>
> </form>
> </pre>
>
>
> any ideas?
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---