Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 67d5c0bfe65b4fd2e6328205a0387fbfde43ff1a 1 parent 1cb40e3
Justin Ko authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/paperclip/railtie.rb
4 lib/paperclip/railtie.rb
@@ -18,8 +18,6 @@ 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
@@ -27,6 +25,8 @@ def self.insert
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)
Please sign in to comment.
Something went wrong with that request. Please try again.