This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| Description: | DataMapper port of the Paperclip plugin by Thoughtbot edit |
Sort by:
Priority
Priority
|
Votes
Votes
|
Last Updated
Last Updated
Loading…
-
fails valid_assignment? when handling uploads through webrick or mongrel
0 comments Created 3 months ago by deepfryedThe problem seems to be that valid_assignment is checking for an instance of File class when webrick/rack/mongrel gives it a Tempfile instance
the following patch fixes the problem
--- lib/dm-paperclip/attachment.rb 2009-08-21 08:50:05.274432152 +1000 +++ lib/dm-paperclip/attachment.rb 2009-08-21 08:58:18.135469700 +1000 @@ -239,7 +239,7 @@ def valid_assignment? file #:nodoc: return true if file.nil? - if(file.is_a?(File)) + if(file.is_a?(::File) or file.is_a?(::Tempfile)) (file.respond_to?(:original_filename) && file.respond_to?(:content_type)) elsif(file.is_a?(Mash)) (file.include?('tempfile') && file.include?('content_type') && file.include?('size') && file.include?('filename'))Comments
-
[jc@macbookpro ~/Desktop/dm-paperclip]# rake (in /Users/jc/Desktop/dm-paperclip) /Users/jc/.rvm/ruby-1.9.1-p243/bin/ruby -I"lib:dm-paperclip" "/Users/jc/.rvm/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/attachment_test.rb" "test/geometry_test.rb" "test/integration_test.rb" "test/iostream_test.rb" "test/paperclip_test.rb" "test/storage_test.rb" "test/thumbnail_test.rb" /Users/jc/.rvm/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load': /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:184: invalid multibyte char (US-ASCII) (SyntaxError) /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:184: syntax error, unexpected $undefined ...ame).returns("sheep_say_b?.png\r\n") ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:185: syntax error, unexpected tIDENTIFIER, expecting keyword_end @not_file.expects(:content_type).returns("image/png\r\n") ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:185: syntax error, unexpected $undefined, expecting keyword_end @not_file.expects(:content_type).returns("image/png\r\n") ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:197: syntax error, unexpected tIDENTIFIER, expecting keyword_end should "remove strange letters and replace with underscore (_)" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:197: syntax error, unexpected tSTRING_BEG, expecting keyword_end should "remove strange letters and replace with underscore (_)" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:198: syntax error, unexpected tIDENTIFIER, expecting keyword_end assert_equal "sheep_say_b_.png", @dummy.avatar.original_filename ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:202: syntax error, unexpected tCONSTANT, expecting keyword_end context "An attachment" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:205: syntax error, unexpected ':', expecting keyword_end :path => ":merb_root/tmp/:attachment/:cl... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:205: syntax error, unexpected tSYMBEG ...t/:class/:style/:id/:basename.:extension" ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:207: syntax error, unexpected tIDENTIFIER, expecting keyword_end FileUtils.rm_rf("tmp") ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:213: syntax error, unexpected tIDENTIFIER, expecting keyword_end "fixtures", ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:214: syntax error, unexpected tINTEGER, expecting keyword_end "5k.png")) ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:217: syntax error, unexpected tIDENTIFIER, expecting keyword_end should "raise if there are not the correct... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:217: syntax error, unexpected tIDENTIFIER, expecting '(' ...uld "raise if there are not the correct columns when you try... ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:217: syntax error, unexpected keyword_when, expecting keyword_end ...re not the correct columns when you try to assign" do ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:224: syntax error, unexpected keyword_return, expecting keyword_end should "return its default_url when no file assigned" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:224: syntax error, unexpected keyword_when, expecting keyword_end should "return its default_url when no file assigned" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:226: syntax error, unexpected tSTRING_BEG, expecting keyword_end assert_equal "/avatars/original/missing.png", @attachment.url ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:227: syntax error, unexpected tSTRING_BEG, expecting keyword_end assert_equal "/avatars/blah/missing.png", @attachment.url(:blah) ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:230: syntax error, unexpected tIDENTIFIER, expecting keyword_end context "with a file assigned in the database" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:230: syntax error, unexpected keyword_in, expecting keyword_end context "with a file assigned in the database" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:233: syntax error, unexpected tIDENTIFIER, expecting keyword_end ...ar_content_type).returns("image/png") ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:233: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' ...ntent_type).returns("image/png") ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:240: syntax error, unexpected keyword_return, expecting keyword_end should "return a correct url even if the file does not exist" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:240: syntax error, unexpected tIDENTIFIER, expecting '(' should "return a correct url even if the file does not exist" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:245: syntax error, unexpected tIDENTIFIER, expecting keyword_end should "make sure the updated_at mtime is... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:245: syntax error, unexpected keyword_in, expecting keyword_end ...sure the updated_at mtime is in the url if it is defined" do ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:249: syntax error, unexpected tIDENTIFIER, expecting keyword_end context "with the updated_at field removed" do ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:254: syntax error, unexpected tIDENTIFIER, expecting keyword_end should "only return the url without the u... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:254: void value expression ... should "only return the url without the updated_at w... ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:254: syntax error, unexpected keyword_when, expecting keyword_end ...url without the updated_at when sent #url" do ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:301: syntax error, unexpected keyword_do_block, expecting keyword_end [:large, :medium, :small].each do |style| ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:311: syntax error, unexpected keyword_do_block, expecting keyword_end [:small, 32, 32, "JPEG"]].each do |style| ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:328: syntax error, unexpected keyword_do_block, expecting keyword_end ...tachment.styles.keys.collect do |style| ... ^ /Users/jc/Desktop/dm-paperclip/test/attachment_test.rb:343: syntax error, unexpected keyword_end, expecting $end from /Users/jc/.rvm/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `block in <main>' from /Users/jc/.rvm/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each' from /Users/jc/.rvm/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `<main>' rake aborted! Command failed with status (1): [/Users/jc/.rvm/ruby-1.9.1-p243/bin/ruby -I...] (See full trace by running task with --trace) [jc@macbookpro ~/Desktop/dm-paperclip]# ruby -v ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] [jc@macbookpro ~/Desktop/dm-paperclip]#Comments
-
using datamapper version 0,10.1
it always complains 'attachment' is not set.
Comments











