Skip to content
Browse files

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 :)
  • Loading branch information...
1 parent 1cb40e3 commit 67d5c0bfe65b4fd2e6328205a0387fbfde43ff1a @justinko committed Feb 1, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/paperclip/railtie.rb
4 lib/paperclip/railtie.rb
@@ -18,15 +18,15 @@ class Railtie < Rails::Railtie
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
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
File.send(:include, Paperclip::Upfile)

0 comments on commit 67d5c0b

Please sign in to comment.
Something went wrong with that request. Please try again.