diff --git a/features/step_definitions/attachment_steps.rb b/features/step_definitions/attachment_steps.rb index 5ad7ce20d..1aecc3a5d 100644 --- a/features/step_definitions/attachment_steps.rb +++ b/features/step_definitions/attachment_steps.rb @@ -49,7 +49,13 @@ def attachment_path(filename) Then /^the attachment should have the same content type as the fixture "([^"]*)"$/ do |filename| in_current_dir do - require 'mime/types' + begin + # Use mime/types/columnar if available, for reduced memory usage + require "mime/types/columnar" + rescue LoadError + require "mime/types" + end + attachment_content_type = `bundle exec #{runner_command} "puts User.last.attachment_content_type"`.strip attachment_content_type.should == MIME::Types.type_for(filename).first.content_type end diff --git a/lib/paperclip.rb b/lib/paperclip.rb index 675022413..c0e07337a 100644 --- a/lib/paperclip.rb +++ b/lib/paperclip.rb @@ -56,7 +56,14 @@ require 'paperclip/attachment_registry' require 'paperclip/filename_cleaner' require 'paperclip/rails_environment' -require 'mime/types' + +begin + # Use mime/types/columnar if available, for reduced memory usage + require "mime/types/columnar" +rescue LoadError + require "mime/types" +end + require 'mimemagic' require 'mimemagic/overlay' require 'logger'