Commit 67d5c0bf by Justin Ko

In the effort of decoupling Rails from unit specs, you can't have any code that…

In the effort of decoupling Rails from unit specs, you can't have any code that calls `Rails` (since it isn't available). In my unit specs that need Paperclip, I call `Paperclip::Railtie.insert` and all is good :)
parent 1cb40e35
......@@ -18,8 +18,6 @@ module Paperclip
class Railtie
def self.insert
Paperclip.options[:logger] = Rails.logger
if defined?(ActiveRecord)
ActiveRecord::Base.send(:include, Paperclip::Glue)
Paperclip.options[:logger] = ActiveRecord::Base.logger
......@@ -27,6 +25,8 @@ module Paperclip
ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, Paperclip::Schema)
ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema)
ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema)
else
Paperclip.options[:logger] = Rails.logger
end
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