From 5072c6f0682d9783831f904284ecb218680aa812 Mon Sep 17 00:00:00 2001 From: Jose Eduardo Garcia-Jimenez Date: Thu, 8 May 2014 00:05:59 -0700 Subject: [PATCH] add types default to form helper and make types param optional --- lib/s3_multipart/action_view_helpers/form_helper.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/s3_multipart/action_view_helpers/form_helper.rb b/lib/s3_multipart/action_view_helpers/form_helper.rb index f8f3ecd..7de728c 100644 --- a/lib/s3_multipart/action_view_helpers/form_helper.rb +++ b/lib/s3_multipart/action_view_helpers/form_helper.rb @@ -3,6 +3,9 @@ module ActionViewHelpers module FormHelper def multipart_uploader_form(options = {}) uploader_digest = S3Multipart::Uploader.serialize(options[:uploader]) + if options[:types] == nil + options[:types] = options[:uploader].constantize.file_types.map { |t| ".#{t}" } + end html = file_field_tag options[:input_name], :accept => options[:types].join(','), :multiple => 'multiple', :data => {:uploader => uploader_digest} html << options[:html].html_safe html << button_tag(:class => options[:button_class]) do