Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Don't require storage module files directly.

  • Loading branch information...
commit 5e4dcb4d79528c96979d5d0082ca75a218e882d8 1 parent a9ac0f8
Jon Yurek jyurek authored
1  lib/paperclip.rb
@@ -37,6 +37,7 @@
37 37 require 'paperclip/interpolations'
38 38 require 'paperclip/style'
39 39 require 'paperclip/attachment'
  40 +require 'paperclip/storage'
40 41 require 'paperclip/callback_compatability'
41 42 require 'paperclip/command_line'
42 43 require 'paperclip/railtie'
8 lib/paperclip/attachment.rb
@@ -275,13 +275,11 @@ def valid_assignment? file #:nodoc:
275 275
276 276 def initialize_storage #:nodoc:
277 277 storage_class_name = @storage.to_s.capitalize
278   - storage_file_name = @storage.to_s.downcase
279 278 begin
280   - require "paperclip/storage/#{storage_file_name}"
281   - rescue MissingSourceFile
282   - raise StorageMethodNotFound, "Cannot load 'paperclip/storage/#{storage_file_name}'"
  279 + @storage_module = Paperclip::Storage.const_get(storage_class_name)
  280 + rescue NameError
  281 + raise StorageMethodNotFound, "Cannot load storage module '#{storage_class_name}'"
283 282 end
284   - @storage_module = Paperclip::Storage.const_get(storage_class_name)
285 283 self.extend(@storage_module)
286 284 end
287 285
2  lib/paperclip/storage.rb
... ... @@ -0,0 +1,2 @@
  1 +require "paperclip/storage/filesystem"
  2 +require "paperclip/storage/s3"

0 comments on commit 5e4dcb4

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