Commit 5e4dcb4d by Jon Yurek

Don't require storage module files directly.

parent a9ac0f86
......@@ -37,6 +37,7 @@ require 'paperclip/thumbnail'
require 'paperclip/interpolations'
require 'paperclip/style'
require 'paperclip/attachment'
require 'paperclip/storage'
require 'paperclip/callback_compatability'
require 'paperclip/command_line'
require 'paperclip/railtie'
......
......@@ -275,13 +275,11 @@ module Paperclip
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
......
require "paperclip/storage/filesystem"
require "paperclip/storage/s3"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment