Sha256: ae196374a69d1835f208fca08ef6b3a6c336a38aef1a77e451ed0adf307ecb99

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 Bytes

Contents

if defined?(Rails)
  module S3Multipart
    class Railtie < Rails::Railtie

      initializer "s3_multipart.action_view" do 
        ActiveSupport.on_load :action_view do
          require 's3_multipart/action_view_helpers/form_helper'
        end
      end

      initializer "s3_multipart.active_record" do
        ActiveRecord::Base.include_root_in_json = false
      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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
s3_multipart-0.0.8 lib/s3_multipart/railtie.rb