Tuesday 15 April 2014

ruby on rails 3 - Using carrierwave to upload PDF causing rollback transaction error after submit -


I am using the carrier to upload files / images in my application. I am collecting files via Amazon AWS works great for uploading images but when I'm trying to add PDF I'm getting a "rollback transaction" error in my server log and I'm not sure That's why that's why.

  Start Mail / Restaurant authenticity_token a ???? ""; UTF8 "= & gt" "= & gt;" filAk5Jh: "{RestaurantsController # from 2013-06-21 14:39:16 to as HTML parameters for 127.0.0.1 at -0400 processing" ++ qmb7owXVgYin2C4nq2O + 09gMeQV27gKeU = "," restaurants "= & gt; {" Name "= & gt;" Tap these "," address "= & gt;" "," Phone "= & gt;" "," Description "= & gt," "," image "= & gt; # & LT; ActionDispatch :: Http :: UploadedFile: 0x00000101da3f98 @ original_filename =" stumble.jpg ", @ content_type =" image / jpeg ", @header = "content-configuration: form data; Name = \ "restaurant [image] \"; Filename = \ "stumble. Jpg \" \ r \ n Content-Type: image / jpeg \ r \ n ", @tempfile = # & lt; file: / var / folders / 6b / Tq59gs0dlf7bp_zg4lcf6fqm0000gn / T / Rakmalteepant20l3062l-40432 -124zf2w & gt;, "remote_image_url" = & gt; "", "menu" = & gt; # & lt; action Dispatch :: :: Acteepi Aplodedfail: 0x00000101da3d18 @ Mul_failnam = "menu. PDF ", @ntent_type =" app / pdf ", @ header =" content-presentation: form-data; Name = \ "restaurant [menu] \"; Filename = \ "menu.pdf \" \ r \ nContent- Type: application / pdf \ r \ n ", @tempfile = # & LT; file: / var / folders / 6b / Tq59gs0dlf7bp_zg4lcf6fqm0000gn / T / RackMultipart20130621-40432- 3cwvjc & gt; & gt; "Commit" = & gt; "Create Restaurant"} (0.2 mms) Start Transactions (0.2 mms) Rollback Transactions http: // localhost: 3000 / Restaurant Class Menu Coupler & lt; CarrierWave :: Uploader :: BACKGROUND CARRIER WAVE :: RMagick # Choose the type of storage used for this uploader: Storage: Fog Deff Store_Dir "Apollo D / # {model.class.to_s.underscore} / # {mounted_as} / # {model.id} "End of the class & lt; ActiveRecord :: Base attr_accessible: address,: description, name,: phone, image ,: remote_image_url ,: menu Mount_uploader image, ImageUploader mount_uploader: menu, ImageUploader end   

new.html.erb

 < Code> & lt; h1 & gt; Add & lt of new restaurant; / h1> & lt;% = form_for (@restaurant ,: html = & gt; {: multiparty = & gt; true}). F |%> gt; & Lt;% = f.label: name% & gt; & Lt;% = f.text_field: Name% & gt; & Lt;% = F.label: Address% & gt; & Lt;% = f.text_field: Address% & gt; & Lt;% = f.label: Phone% & gt; & Lt;% = f.text_field: Phone% & gt; & Lt;% = f.label: Details% & gt; & Lt;% = f.text_field: description% & gt; & Lt;% = f.label: upload_image% & gt; & Lt;% = f.file_field: Image% & gt; & Lt;% = f.label: remote_image_url, "or image url:"% " & Lt;% = f.text_field: remote_image_url% & gt; & Lt;% = f.label: upload_menu% & gt; & Lt;% = f.file_field: Menu% & gt; & Lt; Br / & gt; & Lt; Br / & gt; & Lt;% = f.submit "Build Restaurant"% & gt; & Lt;% end% & gt; Classroom Controller & lt; AppController def new @restaurant = restaurant. Make new end def @restaurant = restaurant.new (param [: restaurant]) @ restaurant.save redirect_to restaurant_path end    

mount_uploader: The menu should be the image plugin

:

/ P>

mount_uploader: menu, menuuploader < / Html>

No comments:

Post a Comment