Commit b0cb54ec by Justin Ko

Set logger to Rails.logger if Rails is available.

parent 67d5c0bf
...@@ -18,6 +18,8 @@ module Paperclip ...@@ -18,6 +18,8 @@ module Paperclip
class Railtie class Railtie
def self.insert def self.insert
Paperclip.options[:logger] = Rails.logger if defined?(Rails)
if defined?(ActiveRecord) if defined?(ActiveRecord)
ActiveRecord::Base.send(:include, Paperclip::Glue) ActiveRecord::Base.send(:include, Paperclip::Glue)
Paperclip.options[:logger] = ActiveRecord::Base.logger Paperclip.options[:logger] = ActiveRecord::Base.logger
...@@ -25,8 +27,6 @@ module Paperclip ...@@ -25,8 +27,6 @@ module Paperclip
ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, Paperclip::Schema) ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, Paperclip::Schema)
ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema) ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema)
ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema) ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema)
else
Paperclip.options[:logger] = Rails.logger
end end
File.send(:include, Paperclip::Upfile) File.send(:include, Paperclip::Upfile)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment