Browse files

Don't require storage module files directly.

  • Loading branch information...
1 parent a9ac0f8 commit 5e4dcb4d79528c96979d5d0082ca75a218e882d8 @jyurek jyurek committed Oct 7, 2010
Showing with 6 additions and 5 deletions.
  1. +1 −0 lib/paperclip.rb
  2. +3 −5 lib/paperclip/attachment.rb
  3. +2 −0 lib/paperclip/storage.rb
View
1 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'
View
8 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
View
2 lib/paperclip/storage.rb
@@ -0,0 +1,2 @@
+require "paperclip/storage/filesystem"
+require "paperclip/storage/s3"

0 comments on commit 5e4dcb4

Please sign in to comment.