Sha256: 9f0a2ebb34e8a416db390bc84a1ae7dea05868deab8d3fb8e3f9f955910f2f42

Contents?: true

Size: 740 Bytes

Versions: 14

Compression:

Stored size: 740 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.include Paperclip::Glue
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kt-paperclip-7.2.2 lib/paperclip/railtie.rb
kt-paperclip-7.2.1 lib/paperclip/railtie.rb
kt-paperclip-7.2.0 lib/paperclip/railtie.rb
kt-paperclip-6.4.2 lib/paperclip/railtie.rb
kt-paperclip-7.1.1 lib/paperclip/railtie.rb
kt-paperclip-7.1.0 lib/paperclip/railtie.rb
kt-paperclip-7.0.1 lib/paperclip/railtie.rb
kt-paperclip-7.0.0 lib/paperclip/railtie.rb
kt-paperclip-6.4.1 lib/paperclip/railtie.rb
kt-paperclip-6.4.0 lib/paperclip/railtie.rb
kt-paperclip-6.3.0 lib/paperclip/railtie.rb
kt-paperclip-6.2.2 lib/paperclip/railtie.rb
kt-paperclip-6.2.1 lib/paperclip/railtie.rb
kt-paperclip-6.2.0 lib/paperclip/railtie.rb