lib/s3_multipart/railtie.rb in s3_multipart-0.0.4 vs lib/s3_multipart/railtie.rb in s3_multipart-0.0.6

- old
+ new

@@ -6,8 +6,20 @@ ActiveSupport.on_load :action_view do require 's3_multipart/action_view_helpers/form_helper' end end + # Load all of the upload controllers in app/uploaders/multipart + initializer "s3_multipart.load_upload_controllers" do + begin + uploaders = Dir.entries(Rails.root.join('app', 'uploaders', 'multipart').to_s).keep_if {|n| n =~ /[uploader]/} + uploaders.each do |uploader| + require "#{Rails.root.join('app', 'uploaders', 'multipart')}/#{uploader}" + end + rescue + # Give some sort of error in the console + end + end + end end end \ No newline at end of file