Permalink
Browse files

Hide ActiveRecord-specific stuff in the Railtie

  • Loading branch information...
1 parent 65e0338 commit bc6ed16bc8abe3c983dca54556a662ddae8ac252 @jyurek jyurek committed Jan 20, 2012
Showing with 10 additions and 6 deletions.
  1. +10 −6 lib/paperclip/railtie.rb
@@ -18,14 +18,18 @@ class Railtie < Rails::Railtie
class Railtie
def self.insert
- ActiveRecord::Base.send(:include, Paperclip::Glue)
- File.send(:include, Paperclip::Upfile)
+ Paperclip.options[:logger] = Rails.logger
+
+ if defined?(ActiveRecord)
+ ActiveRecord::Base.send(:include, Paperclip::Glue)
+ Paperclip.options[:logger] = ActiveRecord::Base.logger
- Paperclip.options[:logger] = defined?(ActiveRecord) ? ActiveRecord::Base.logger : Rails.logger
+ ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, Paperclip::Schema)
+ ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema)
+ ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema)
+ end
- ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, Paperclip::Schema)
- ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema)
- ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema)
+ File.send(:include, Paperclip::Upfile)
end
end
end

0 comments on commit bc6ed16

Please sign in to comment.