Sha256: e453b75631ebe4e9829e8b681b04b768a4e38c0009f8ccfaaaa19d1f334f4105

Contents?: true

Size: 748 Bytes

Versions: 51

Compression:

Stored size: 748 Bytes

Contents

require 'paperclip'
require 'paperclip/schema'

module Paperclip
  require 'rails'

  class Railtie < Rails::Railtie
    initializer 'paperclip.insert_into_active_record' do |app|
      ActiveSupport.on_load :active_record do
        Paperclip::Railtie.insert
      end

      if app.config.respond_to?(:paperclip_defaults)
        Paperclip::Attachment.default_options.merge!(app.config.paperclip_defaults)
      end
    end

    rake_tasks { load "tasks/paperclip.rake" }
  end

  class Railtie
    def self.insert
      Paperclip.options[:logger] = Rails.logger

      if defined?(ActiveRecord)
        Paperclip.options[:logger] = ActiveRecord::Base.logger
        ActiveRecord::Base.send(:include, Paperclip::Glue)
      end
    end
  end
end

Version data entries

51 entries across 49 versions & 6 rubygems

Version Path
kt-paperclip-5.4.0 lib/paperclip/railtie.rb
kt-paperclip-4.4.0 lib/paperclip/railtie.rb
paperclip-6.1.0 lib/paperclip/railtie.rb
paperclip-6.0.0 lib/paperclip/railtie.rb
paperclip-5.3.0 lib/paperclip/railtie.rb
paperclip-5.2.1 lib/paperclip/railtie.rb
paperclip-5.2.0 lib/paperclip/railtie.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/paperclip-5.1.0/lib/paperclip/railtie.rb
paperclip-5.1.0 lib/paperclip/railtie.rb
paperclip-5.0.0 lib/paperclip/railtie.rb
paperclip-4.3.7 lib/paperclip/railtie.rb
paperclip_jk-5.0.0.beta2 lib/paperclip/railtie.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/paperclip-4.3.6/lib/paperclip/railtie.rb
paperclip-5.0.0.beta2 lib/paperclip/railtie.rb
paperclip-5.0.0.beta1 lib/paperclip/railtie.rb
paperclip-4.3.6 lib/paperclip/railtie.rb
paperclip-4.3.5 lib/paperclip/railtie.rb
paperclip-4.3.4 lib/paperclip/railtie.rb
paperclip-4.3.3 lib/paperclip/railtie.rb
paperclip-4.3.2 lib/paperclip/railtie.rb