Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't require storage module files directly.
  • Loading branch information
Jon Yurek committed Oct 7, 2010
1 parent a9ac0f8 commit 5e4dcb4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/paperclip.rb
Expand Up @@ -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'
Expand Down
8 changes: 3 additions & 5 deletions lib/paperclip/attachment.rb
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions 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.