Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 67d5c0bfe65b4fd2e6328205a0387fbfde43ff1a 1 parent 1cb40e3
Justin Ko authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  lib/paperclip/railtie.rb
4  lib/paperclip/railtie.rb
@@ -18,8 +18,6 @@ class Railtie < Rails::Railtie
18 18
 
19 19
   class Railtie
20 20
     def self.insert
21  
-      Paperclip.options[:logger] = Rails.logger
22  
-
23 21
       if defined?(ActiveRecord)
24 22
         ActiveRecord::Base.send(:include, Paperclip::Glue)
25 23
         Paperclip.options[:logger] = ActiveRecord::Base.logger
@@ -27,6 +25,8 @@ def self.insert
27 25
         ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, Paperclip::Schema)
28 26
         ActiveRecord::ConnectionAdapters::Table.send(:include, Paperclip::Schema)
29 27
         ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Paperclip::Schema)
  28
+      else
  29
+        Paperclip.options[:logger] = Rails.logger
30 30
       end
31 31
 
32 32
       File.send(:include, Paperclip::Upfile)

0 notes on commit 67d5c0b

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