F.submit calls #destroy

Hi group,
i have a rather weird problem - if i use f.submit on my form, the
controller calls #destroy.
i can workaround that if i use button_to “update”, :controller
=> :mycontroller, :action => :update, but i don’t really want that,
and i want to get this issue fixed.

anyone ever encountered this bug and found a solution?

routes are absolutely okay.

greetings

Hi.

Could you post all the code of your form?

it’s rather complex, but here it is:

it belongs to a polymorphic association with “resource”. luckily, the
other polymorphic children of resource still work fine, it’s just with
this one. the partials are just for keeping things organized, none of
these does anything terrible.

i’d be glad if someone was able to help!

<%= render ‘layouts/form’ %>
<%= render :partial=>‘resources/form’ %>
<%= render :partial => ‘shared/overlay_init’ %>

        <%= render :partial => 'shared/site_header',
           :locals => {:breadcrumbs => "Administration |

Medienobjekte",
:heading => @heading,
:subnav => “”
} %>

<%= form_for @concrete_resource, :html => { :multipart => true } do |
f| %>
<% if @concrete_resource.errors.any? %>


<%= pluralize(@concrete_resource.errors.count,
“error”) %> prohibited this concrete_resource from being saved:



    <% @concrete_resource.errors.full_messages.each do |msg|
    %>
  • <%= msg %>

  • <% end %>


<% end %>

<div class="form-content">

    <%= render :partial => 'resources/title_category_tags'%>

  <div class="form-element-container" style="border-bottom:  1px

dotted black">


Copyright-Hinweis:


<%= f.text_field :copyright, :class =>“cleardefault”%>

 <div class="form-element-container" style="border-bottom:  1px

dotted black">


Copyright-Informationen (intern):


<%= f.text_area :copyright_information, :class =>
“smallarea”%>

<div class="form-element-container">
  <div class="form-element-caption">
      Bild hochladen:
  </div>
  <div class="form-element">
       <%= f.file_field :medium_image%>
  </div>
  <div style="float:left; margin-left: -160px; width: 560px;">
    (Bildformat: 340x257 Pixel)
  </div>
</div>

<% if params[:subtype].nil? && !params[:type].nil? %>
    <%= render :partial => 'media/forms/' + params[:type] + 'form'

%>
<% elsif !params[:subtype].nil? %>

    <%= render :partial => 'media/forms/subtype_forms/' +

params[:subtype] + ‘form’ %>
<% else %>
<%= render :partial => @concrete_resource.get_form %>
<% end %>

  <div class="popmenu popmenu-button-left popmenu-hide"

style=“width:850px;” title=“Projektbeschreibung”>

      <div class="form-left">
        <div class="form-element-caption">
            Einleitung <span style="color:red">*</span>
        </div>
        <div style="width:560px; float:left;">
            <%= f.text_area :teaser, :class => "mceSimple" %>
        </div>

        <div style="width:560px; border-top: 1px dotted black;

margin-top:20px; margin-bottom:15px; float:left;">

        <div class="form-element-caption" style="width:160px;">
            Projektbeschreibung <span style="color:red">*</span>
        </div><br>
        <div style="width:560px; float:left;">
        <%= f.text_area :long_description, :class => "mceBig" %>
        </div>
      </div>

    <div class="form-right" style=" width: 230px;">
        <br>
        blah blah blah
      </div>
     </div>
    </div>





      <div class="popmenu popmenu-button-left popmenu-show"

title=“Medium-Ressourcen” style=“margin-top:20px; width: 850px;”>

       <div class="form-left">
            <%= render :partial => 'resources/

related_resources_form’ %>


<%= f.submit “Medium aktualisieren und speichern” %>
        </div>
        <div class="form-right">
            blah blah blah
        </div>

      </div>







<div class="actions" style="width: 350px;float:left;">
    <%# button_to "Medium aktualisieren und

speichern", :controller => :media, :action => :update %>
<% f.submit “Medium aktualisieren und speichern” %>

</div>

 <%= render :partial => "resources/form_footer", :locals =>

{:object => @concrete_resource, :name => “Medium”, :plural =>
“Medien”} %>

<% end %>

On 21 November 2011 13:20, manavortex [email protected] wrote:

Hi group,
i have a rather weird problem - if i use f.submit on my form, the
controller calls #destroy.

What do you see in the log when you click submit?

Also when odd things are happening it is always a good idea to check
the web page for valid html. Copy the complete html source from the
browser and paste it into the w3c html validator.

Colin

On 24 Nov 2011, at 17:12, manavortex [email protected] wrote:

it’s rather complex, but here it is:

it belongs to a polymorphic association with “resource”. luckily, the
other polymorphic children of resource still work fine, it’s just with
this one. the partials are just for keeping things organized, none of
these does anything terrible.

i’d be glad if someone was able to help!

Do any of those partials render forms? Nesting forms is a definite bad
idea.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs