title: Rails file_field not showing dialog to select file
body: <p>I am developing a rails application in which I have a form_for which has a file_field inside. At first, I didn't use the form_for and when I click on it, it show a dialog to select the file. However, when I started to use the form_for, when I click on it, nothing happens. This is the code:</p>
  
  <pre><code>= form_for n, url: news_path( n ), html: { method: :put } do |f|
    %table
      %tr
        %td
          = f.text_field :title, name: 'news[title]'
        %td.centered{ rowspan: '2' }
          = image_tag news.picture.url(:small), align: 'middle', width: '90', height: '100%'
          = f.file_field :picture, id: 'selectedFile', size: '24', onchange: "readURLprofile(this);", style: 'display:none'
          %input#browseButton.upload_picture{ type: "button", value: "Upload picture", onclick: "selectedFile.click()" }
      %tr
        %td
          = f.text_area :description, name: 'news[description]'
      %tr
        %td{ colspan: '2' }
          = f.submit "Upload", id: 'submit_news', style: 'display:none', rel: news.id
          = link_to '#', id: "save_news#{ index }", title: 'Save', rel: news.id do
            %i.fa.fa-2x.fa-floppy-o
          = link_to '#', id: "close_news#{ index }", title: 'Close', rel: news.id do
            %i.fa.fa-2x.fa-times
  </code></pre>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This is the resulting HTML code:</p>
  
  <pre><code>&lt;form method="post" id="edit_news_532d6ee6b4f2d7bc06000002" enctype="multipart/form-data" class="edit_news" action="/news/532d6ee6b4f2d7bc06000002" accept-charset="UTF-8"&gt;
    &lt;div style="margin:0;padding:0;display:inline"&gt;
    &lt;input type="hidden" value="✓" name="utf8"&gt;
    &lt;input type="hidden" value="put" name="_method"&gt;
    &lt;input type="hidden" value="/hDJduBBvn7VX4DCwhDKnXHV/dLcXjXkEfQ3JeAJiZg=" name="authenticity_token"&gt;&lt;/div&gt;
    &lt;table style="" rel="532d6ee6b4f2d7bc06000002" id="news_editable532d6ee6b4f2d7bc06000002" class="infoindex news_editable"&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;input type="text" value="" size="30" name="news[title]" id="news_title" class="infoindexeditabletext"&gt;
          &lt;/td&gt;
          &lt;td rowspan="2" class="td_centered"&gt;
            &lt;img width="90" align="middle" height="100%" src="/pictures/532d6ee6b4f2d7bc06000002/small.jpg?1395486436" id="original_picture" class="news_picture" alt="Small"&gt;
            &lt;img style="display: none; width: 90px;" src="/assets/" id="picture_preview" alt="Assets"&gt;
            &lt;input type="file" style="display:none" rel="532d6ee6b4f2d7bc06000002" onchange="readURLprofile(this);" name="news[picture]" id="news_picture" class="selected_file"&gt;
            &lt;input type="button" value="Subir imagen" onclick="$('.selected_file[rel=532d6ee6b4f2d7bc06000002]').click()" id="browseButton" class="upload_picture"&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;textarea rows="20" name="news[description]" id="news_description" cols="40" class="infoindexeditabletextarea"&gt;asdf&lt;/textarea&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td colspan="2"&gt;
            &lt;input type="submit" value="Upload" style="display:none" rel="532d6ee6b4f2d7bc06000002" name="commit" id="submit_news"&gt;
            &lt;a title="Upload" rel="532d6ee6b4f2d7bc06000002" id="save_news1" class="save_news tooltip" href="#"&gt;&lt;i class="fa fa-2x fa-floppy-o"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;a title="Close" rel="532d6ee6b4f2d7bc06000002" id="close_news1" class="close_news tooltip" href="#"&gt;&lt;i class="fa fa-2x fa-times"&gt;&lt;/i&gt;&lt;/a&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>