title: Rails routing acts weirdly
body: <p>Suddenly my Rails application acts weirdly. If I attach an image on a edit page and submit the form, <code>show</code> action is called instead of update action. If I don't attach any image, it's ok.</p>
  
  <h3>Routes</h3>
  
  <pre><code>namespace :admin do
    resources :products do
      collection do
        get :download_images
        get :all_styles
        post :compress_images
      end
    end
  end
  </code></pre>
  
  <h3>View</h3>
  
  <pre><code>%h1 Edit Product
  
  = form_for [:admin, @product], :html =&gt; {:multipart =&gt; true} do |f|
    - if f.object.accessory?
      = render 'form_accessory', :f =&gt; f
    - else
      = render 'form', :f =&gt; f
  
  [_form partial]
  :javascript
    function exclusiveCheck(check_box) {
      if (check_box.checked) {
        $('#pictures_fieldset .is_main').attr('checked', false);
        check_box.checked = true;
      }
    }
  - error_messages_for f.object
  
  %fieldset.span-23
    %legend
    .row
      = f.label :category_id, :class =&gt; "required"
      %br
      = f.select :category_id, array_of_categories('garment'), :include_blank =&gt; true
      = f.check_box :new_in_category
      = image_tag "new_icon.png"
  
    .row
      = f.label :style_no, :class =&gt; "required"
      %br
      = f.text_field :style_no, :style =&gt; "width: 5em;"
  
    .row
      = f.label :name, :class =&gt; "required"
      %br
      = f.text_field :name
  
    .row
      = f.label :fabric_info, :class =&gt; ""
      %br
      = f.text_field :fabric_info, :style =&gt; "width: 90%;"
  
    .row
      = f.label :lb_per_piece, "Weight", :class =&gt; "required"
      %br
      = f.text_field :lb_per_piece, :style =&gt; "width: 3em;"
  
    .row
      .span-3
        = f.label :price, :class =&gt; "required"
        %br
        = f.text_field :price, :style =&gt; "width: 6em;"
      .span-3
        = f.label :original_price, :class =&gt; ""
        %br
        = f.text_field :original_price, :style =&gt; "width: 6em;"
      .span-10
        %label Discount Rate
        %br
        = text_field_tag :percent, nil, :style =&gt; "width: 3em;", :id =&gt; "percent"
        = "%"
        = link_to_function "Set", "setPrice();"
        = f.check_box :new_in_sale
        = image_tag "new_icon.png"
    .row
      = f.label :video, :class =&gt; ""
      %br
      = f.text_field :video, :style =&gt; "width: 15em;"
      (Upload videos to data.ohyesfashion.com at ~/files/videos directory.)
  
    .row
      = f.label :available_on
      %br
      = f.text_field :available_on, :class =&gt; 'date'
  
    .row
      = f.check_box :active
      = f.label :active, :class =&gt; ""
  
    .row
      = f.check_box :new_arrival
      = f.label :new_arrival, :class =&gt; ""
      = f.check_box :new_in_new_arrival?
      = image_tag "new_icon.png"
  
    .row
      = f.check_box :best
      = f.label :best, :class =&gt; ""
      = f.check_box :new_in_best
      = image_tag "new_icon.png"
  .span-24.last
    %button.button.positive(type="submit")
      = icon_for(:accept, "Save")
  
  %fieldset
    %legend Sizes
    - Product::SIZES.each do |size|
      .span-2
        = size.to_s.upcase
        = f.select size, [*0..20].map { |i| i.to_s }
  
  .span-24
    .span-12
      %fieldset
        %legend Descriptions
        - Description.order("code, name").each do |description|
          .row
            = check_box_tag "descriptions[]", description.id, f.object.descriptions.include?(description)
            = "[#{description.code}]"
            = description.name
        .row
          New Description 
          = text_field_tag :new_description_name
    .span-12.last
      %fieldset(style="float: right;")
        %legend Colors
        .span-11
        - Color.order("name").each do |color|
          .row
            .span-1
              = check_box_tag "colors[]", color.id, f.object.colors.include?(color)
            .span-4
              = color_box color
            .span-3
              = check_box_tag "sold_out_colors[]", color.id, (f.object.colors.include?(color) and Colorship.sold_out?(f.object, color))
              Sold Out
            .span-2
              = check_box_tag "is_new_colors[]", color.id, (f.object.colors.include?(color) and Colorship.is_new?(f.object, color))
              New
  
  .span-24.last
    %button.button.positive(type="submit")
      = icon_for(:accept, "Save")
  
  
  - (15 - f.object.pictures.size).times { f.object.pictures.build }
  %fieldset#pictures_fieldset
    %legend Images
    .row
      = f.label :model_id, "Model"
      = f.select :model_id, PhotoModel.all.map { |i| [i.name, i.id] }, :include_blank =&gt; true
    %br
    = f.fields_for :pictures do |ff|
      .span-7(style="height: 150px;")
        - if ff.object.new_record?
          = ff.file_field :image
        - else
          = image_tag ff.object.image.url(:w45)
          %br
          = ff.object.image_file_name
          %br
          = ff.check_box :is_main, :onclick =&gt; "exclusiveCheck(this)", :class =&gt; "is_main"
          Title
          %br
          = ff.check_box "_destroy"
          Delete
  
  
  .span-24.last
    = link_to icon_for(:back, "Back"), :back, :class =&gt; "button negative"
    %button.button.positive(type="submit")
      = icon_for(:accept, "Save")
  
  :javascript
  
    function setPrice() {
      if ($('#product_original_price').val() != '' &amp;&amp; $('#percent').val() != '') {
        var originalPrice = parseFloat($('#product_original_price').val());
        var percent = parseFloat($('#percent').val());
        $('#product_price').val(originalPrice * (100 - percent) / 100.0);
      }
    }
  </code></pre>
  
  <p>Any idea what's going on? It used to work fine.</p>