title: Paperclip upload causes update.js.erb to output code as text
body: <p>I've been having this problem with Paperclip for a while.  New/Edit form submits and saves/updates, but create.js and update.js renders the code (that normally would be a view) as text to <a href="http://localhost:3000/albums/9.js" rel="nofollow noreferrer">http://localhost:3000/albums/9.js</a> (if it's the 9th album being updated), instead of a view in a modal on localhost:3000.    </p>
  
  <p>so instead of rendering a view, i get this text on /albums/9.js: $("#actionEdit").html("Album Updated.")</p>
  
  <p>album model</p>
  
  <pre><code>belongs_to :band
    has_many :songs
  
    has_attached_file :album_artwork_1,
                      styles: { thumb: ["64x64#", :jpg] },
                      convert_options: { thumb: "-strip",
                                         original: "-strip" }
  
    has_attached_file :album_artwork_2,
                      styles: { thumb: ["64x64#", :jpg] },
                      convert_options: { thumb: "-strip",
                                         original: "-strip" }
  
    has_attached_file :album_artwork_3,
                      styles: { thumb: ["64x64#", :jpg] },
                      convert_options: { thumb: "-strip",
                                         original: "-strip" }
  
    do_not_validate_attachment_file_type :album_artwork_1
    do_not_validate_attachment_file_type :album_artwork_2
    do_not_validate_attachment_file_type :album_artwork_3
  
    validates :album_name, presence: true
    validates :album_release_date, presence: true
  </code></pre>
  
  <p>albums controller</p>
  
  <pre><code>def new
      binding.pry
      @band = Band.find(params[:band])
      authorize @band, :admin?
  
      @album = Album.new
  
      respond_to do |format|
        format.js
      end
    end
  
    def create
      @band = Band.find(params[:album][:band].to_i)
      authorize @band, :admin?
  
      @album = @band.albums.build(album_params)
  
      if @album.save
  
        @records = []
        @band.albums.each do |album|
          @records &lt;&lt; album 
        end
        @band.eps.each do |ep|
          @records &lt;&lt; ep 
        end
        @band.songs.each do |song|
          @records &lt;&lt; song 
        end
  
        @records_ordered = @records #.sort.reverse!
  
        respond_to do |format|
          format.js
        end
      else
  
        respond_to do |format|
          format.js
        end
      end
    end
  
    def edit
      @band = Band.find(params[:band])
      authorize @band, :admin?
  
      @album = Album.find(params[:id])
  
      respond_to do |format|
        format.js
      end
    end
  
    def update
      binding.pry 
      @band = Band.find(params[:album][:band])
      authorize @band, :admin?
  
      @album = Album.find(params[:id])
  
      if @album.update(album_params)
  
        respond_to do |format|
          format.js
        end
      else
  
        @fail = "w4rd"
  
        respond_to do |format|
          format.js
        end
      end
    end
  </code></pre>
  
  <p>form</p>
  
  <pre><code>&lt;%=simple_form_for(@album, remote: true, :authenticity_token =&gt; true, format: :js) do |f| %&gt;
  
  &lt;% if @album.album_artwork_1.present? %&gt;
        &lt;%= link_to image_tag(@album.album_artwork_1.url(:thumb), class: 'media-object'), @album.album_artwork_1.url, target: '_blank' %&gt; 
      &lt;% end %&gt;
      &lt;div class="form-group"&gt;
        &lt;%= f.input :album_artwork_1, as: :file %&gt;
      &lt;/div&gt;
  
      &lt;% if @album.album_artwork_2.present? %&gt;
        &lt;%= link_to image_tag(@album.album_artwork_2.url(:thumb), class: 'media-object'), @album.album_artwork_2.url, target: '_blank' %&gt; 
      &lt;% end %&gt;
      &lt;div class="form-group"&gt;
        &lt;%= f.input :album_artwork_2, as: :file %&gt;
      &lt;/div&gt;
  
      &lt;% if @album.album_artwork_3.present? %&gt;
        &lt;%= link_to image_tag(@album.album_artwork_3.url(:thumb), class: 'media-object'), @album.album_artwork_3.url, target: '_blank' %&gt; 
      &lt;% end %&gt;
      &lt;div class="form-group"&gt;
        &lt;%= f.input :album_artwork_3, as: :file %&gt;
      &lt;/div&gt;
  
  &lt;br&gt;&lt;br&gt;
      &lt;div id="albumsubmit"&gt;
        &lt;% if params[:action] === "edit" %&gt;
          &lt;div class="form-actions"&gt;
            &lt;%= f.button :submit, "Update Album", class: "btn btn-primary" %&gt;
          &lt;/div&gt;
        &lt;% else %&gt;
          &lt;div class="form-actions"&gt;
            &lt;%= f.button :submit, "Create Album", class: "btn btn-primary" %&gt;
          &lt;/div&gt;
        &lt;% end %&gt;
      &lt;/div&gt;
  
     &lt;% end %&gt;
  </code></pre>
  
  <p>update.js.erb</p>
  
  <pre><code>$("#actionEdit").html("&lt;%= j render 'updated' %&gt;")
  </code></pre>
  
  <p>schema</p>
  
  <pre><code>create_table "albums", force: :cascade do |t|
      t.datetime "created_at", null: false
      t.datetime "updated_at", null: false
  t.string "album_artwork_1_file_name"
      t.string "album_artwork_1_content_type"
      t.integer "album_artwork_1_file_size"
      t.datetime "album_artwork_1_updated_at"
      t.string "album_artwork_2_file_name"
      t.string "album_artwork_2_content_type"
      t.integer "album_artwork_2_file_size"
      t.datetime "album_artwork_2_updated_at"
      t.string "album_artwork_3_file_name"
      t.string "album_artwork_3_content_type"
      t.integer "album_artwork_3_file_size"
      t.datetime "album_artwork_3_updated_at"
  </code></pre>
  
  <p>params coming into #update</p>
  
  <pre><code>[1] pry(#&lt;AlbumsController&gt;)&gt; params
  =&gt; &lt;ActionController::Parameters {"utf8"=&gt;"✓", "_method"=&gt;"patch", "authenticity_token"=&gt;"B/g/tnhObi6YmY6gqY0hTzJyiewshxVN6S1Dv+1yspGiRQZAlr8qdRiMtDyOh1/1VYvmr1FW9AsClLnW6xt9rg==", "album"=&gt;{"band"=&gt;"1", "album_name"=&gt;"Test", "album_release_date"=&gt;"2017-04-29", "produced_by"=&gt;"", "recorded_at"=&gt;"", "engineered_by"=&gt;"", "second_engineers"=&gt;"", "mixed_by"=&gt;"", "mastered_by"=&gt;"", "artwork_by"=&gt;"", "photography_by"=&gt;"", "art_direction_by"=&gt;"", "construction_by"=&gt;"", "booking"=&gt;"", "litigation"=&gt;"", "additional_musicians"=&gt;"", "copyright"=&gt;"", "websites"=&gt;"", "contacts"=&gt;"", "other"=&gt;"", "album_artwork_2"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x007f681a3b4ca8 @tempfile=#&lt;Tempfile:/tmp/RackMultipart20170416-32079-mie4xo.jpg&gt;, @original_filename="c.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"album[album_artwork_2]\"; filename=\"c.jpg\"\r\nContent-Type: image/jpeg\r\n"&gt;}, "commit"=&gt;"Update Album", "controller"=&gt;"albums", "action"=&gt;"update", "id"=&gt;"7", "format"=&gt;"js"} permitted: false&gt;
  [2] pry(#&lt;AlbumsController&gt;)&gt;
  </code></pre>