Using the same form partial in both create and edit in my case new and preview. partial looks somewhat like this (I use HAML)
=form_tag ({:action => params[:action]}, :multipart => true)
=text_field :newsletter, :title
=text_area :newsletter, :body
=file_field :newsletter,:attachment
-if params[:action] == "preview"
=button_to "select contacts and send", :action => "contacts"
=submit_tag "save and preview"
but in the html-output is
...
<input type="submit" value="select contacts and send"/>
<input type="hidden" value="rwYnZlEpWV4dR89zjgprEALBYmP0xqM3lnKt9JDLyak=" name="authenticity_token"/>
<input type="submit" value="save and preview" name="commit"/>
...
why does the button_to not generate the button-to form?
a solution is to keep the button outside the partial and only 1 per form, but how can I have 2 buttons in the same form?
edit: another workaround would be a hidden checkbox that is set by javascript if the button_to is pressed and submits the form, separating them in the controller