lib/paperclip/railtie.rb in paperclip-3.0.2 vs lib/paperclip/railtie.rb in paperclip-3.0.3

- old
+ new

@@ -1,30 +1,27 @@ require 'paperclip' require 'paperclip/schema' module Paperclip 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 + + rake_tasks { load "tasks/paperclip.rake" } end class Railtie def self.insert - Paperclip.options[:logger] = Rails.logger if defined?(Rails) + Paperclip.options[:logger] = Rails.logger if defined?(ActiveRecord) Paperclip.options[:logger] = ActiveRecord::Base.logger ActiveRecord::Base.send(:include, Paperclip::Glue) - ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, Paperclip::Schema) - ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema) - ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema) end end end end