diff --git a/lib/paperclip.rb b/lib/paperclip.rb index 98861504e..5d2fda46e 100644 --- a/lib/paperclip.rb +++ b/lib/paperclip.rb @@ -37,6 +37,7 @@ require 'paperclip/interpolations' require 'paperclip/style' require 'paperclip/attachment' +require 'paperclip/storage' require 'paperclip/callback_compatability' require 'paperclip/command_line' require 'paperclip/railtie' diff --git a/lib/paperclip/attachment.rb b/lib/paperclip/attachment.rb index a984b5aa1..5ea6177f3 100644 --- a/lib/paperclip/attachment.rb +++ b/lib/paperclip/attachment.rb @@ -275,13 +275,11 @@ def valid_assignment? file #:nodoc: def initialize_storage #:nodoc: storage_class_name = @storage.to_s.capitalize - storage_file_name = @storage.to_s.downcase begin - require "paperclip/storage/#{storage_file_name}" - rescue MissingSourceFile - raise StorageMethodNotFound, "Cannot load 'paperclip/storage/#{storage_file_name}'" + @storage_module = Paperclip::Storage.const_get(storage_class_name) + rescue NameError + raise StorageMethodNotFound, "Cannot load storage module '#{storage_class_name}'" end - @storage_module = Paperclip::Storage.const_get(storage_class_name) self.extend(@storage_module) end diff --git a/lib/paperclip/storage.rb b/lib/paperclip/storage.rb index e69de29bb..a716bbbc8 100644 --- a/lib/paperclip/storage.rb +++ b/lib/paperclip/storage.rb @@ -0,0 +1,2 @@ +require "paperclip/storage/filesystem" +require "paperclip/storage/s3"