Sha256: 8949965fcc6769df591a9827078c0d63998e3a65d5ed38c716a72ab2468b51dd

Contents?: true

Size: 626 Bytes

Versions: 9

Compression:

Stored size: 626 Bytes

Contents

require 'paperclip'

module Paperclip
  if defined? Rails::Railtie
    require 'rails'
    class Railtie < Rails::Railtie
      initializer 'paperclip.insert_into_active_record' do
        ActiveSupport.on_load :active_record do
          Paperclip::Railtie.insert
        end
      end
      rake_tasks do
        load "tasks/paperclip.rake"
      end
    end
  end

  class Railtie
    def self.insert
      ActiveRecord::Base.send(:include, Paperclip::Glue)
      File.send(:include, Paperclip::Upfile)

      Paperclip.options[:logger] = defined?(ActiveRecord) ? ActiveRecord::Base.logger : Rails.logger
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
mender_paperclip-2.4.3.1 lib/paperclip/railtie.rb
jmcnevin-paperclip-2.4.5.1 lib/paperclip/railtie.rb
jmcnevin-paperclip-2.4.5 lib/paperclip/railtie.rb
paperclip-2.4.5 lib/paperclip/railtie.rb
mender_paperclip-2.4.3 lib/paperclip/railtie.rb
paperclip-2.4.4 lib/paperclip/railtie.rb
paperclip-2.4.3 lib/paperclip/railtie.rb
paperclip-2.4.2 lib/paperclip/railtie.rb
paperclip-2.4.1 lib/paperclip/railtie.rb