Commit afc36559 by jyurek

Fixed problem with #file being nil after save.

git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@425 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
parent 349a466f
......@@ -98,6 +98,7 @@ module Paperclip
# style. Useful for streaming with +send_file+.
def to_io style = nil
begin
style ||= @default_style
@processed_files[style] || File.new(path(style))
rescue Errno::ENOENT
nil
......@@ -211,7 +212,7 @@ module Paperclip
FileUtils.mkdir_p( File.dirname(path(style)) )
@processed_files[style] = file.stream_to(path(style)) unless file.path == path(style)
end
@file = @processed_files[nil]
@file = @processed_files[@default_style]
end
def flush_deletes #:nodoc:
......
......@@ -84,6 +84,14 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal style[3].to_s, format.to_s
end
end
should "have #file be equal #to_io(:original)" do
assert @attachment.file == @attachment.to_io(:original)
end
should "still have its #file attribute not be nil" do
assert ! @attachment.file.nil?
end
end
end
end
......
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