RailsCasts Pro episodes are now free!

Learn more or hide this

Synthmax's Profile

GitHub User: maxgronlund

Site: max@synthmax.dk

Comments by Synthmax

Avatar

I'm having a problem with many browsers opening the file instead of downloading it.

The best solution so far has been to use send_data and set ' disposition: "attachment; filename=A_COOL_TITLE" instead

ruby
respond_to do |format|
      format.html
      format.csv { 
        send_data(
          @products.to_csv, 
          disposition: "attachment; filename=A_COOL_TITLE",
          type: 'text/csv',
          stream: 'true', 
          buffer_size: '4096' 
        )

      }
end

I also found that turbo-link can cause issues so I added 'data-no-turbolink' => true to the download link

Avatar

I forgot this little monkey patch to get true the validation

Use file_field_tag instead of file_field

<%#= f.file_field :image, multiple: true, name: "painting[image]" %>
<%= file_field_tag(:image, multiple: true, name: "painting[image]") %>

Avatar

SUCESS!!
jquey-file-upload is not fully compatible with jquery 1.9.1
adding the jquery-migrate-1.1.1 plugin did the trick

Avatar

Strange. I updated rails to 3.2.13 and it broke again, pulling it back to 3.2.8 and nothing could bring it alive again

Avatar

I downloaded the example and ran it without any luck, seems like something is broken.
Tried with Chrome and Safari.

When dropping files, nothing happens, when adding files from the dialog, nothing happens.
Can someone confirm or am I missing something.

Avatar

Yes ++
I need it all the time when a customer has a huge amount of legacy date in XLS format they want to move online

Avatar

I had a problem with twitter-boot-strap and jcrop

The fix was to add the following to the css file

img {
max-width: none;

}

.preview{
display:block;
overflow:hidden;
}