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 ...@@ -18,8 +18,6 @@ module Paperclip
class Railtie class Railtie
def self.insert def self.insert
Paperclip.options[:logger] = Rails.logger
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
...@@ -27,6 +25,8 @@ module Paperclip ...@@ -27,6 +25,8 @@ 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