goooseman / rails-multimodel-upload-demo

Rails 4 app, which uses jquery-fileupload and paperclip to upload multiple photos from another models form.
8 stars 2 forks source link

uploaded file can not be saved #1

Closed ssipin closed 10 years ago

ssipin commented 10 years ago

had a go with the demo, select upload works fine, but OK button is not saving files either to database or on disk.

goooseman commented 10 years ago

Strange behaviour. I've just tested it on a clean install with ruby 2.0 and everything works fine. I can see my uploaded images in Items and upload new ones. Uploaded images are saved in public/system/uploads Did you get any errors in log?

ssipin commented 10 years ago

thanks for responding, it’s rather late here in Australia, i’ll have another go tomorrow night.

a complete log as follow:

80 580 $ git clone https://github.com/goooseman/rails-multimodel-upload-demo.git Cloning into 'rails-multimodel-upload-demo'... remote: Counting objects: 5657, done. remote: Compressing objects: 100% (4363/4363), done. remote: Total 5657 (delta 900), reused 5657 (delta 900) Receiving objects: 100% (5657/5657), 29.74 MiB | 377.00 KiB/s, done. Resolving deltas: 100% (900/900), done. Checking connectivity... done ml in /Users/ml (49 entries, 26 hidden) 81 581 $ ls Desktop Public gss-d Documents Sites gss-e Downloads bootstrap_uploader gss-f Insync dwhelper gss20131212.zip Library gss rails-multimodel-upload-demo Movies gss-a sample_app_2nd_ed Music gss-b synbills Pictures gss-c ml in /Users/ml (49 entries, 26 hidden) 82 582 $ cd rails-multimodel-upload-demo/ ml in /Users/ml/rails-multimodel-upload-demo (17 entries, 2 hidden) 83 583 $ ls Gemfile README.md Rakefile bin config.ru lib public vendor Gemfile.lock README.rdoc app config db log test ml in /Users/ml/rails-multimodel-upload-demo (17 entries, 2 hidden) 84 584 $ bundle install Using rake (10.1.0) Using i18n (0.6.5) Using minitest (4.7.5) Using multi_json (1.8.1) Using atomic (1.1.14) Using thread_safe (0.1.3) Using tzinfo (0.3.37) Using activesupport (4.0.0) Using builder (3.1.4) Using erubis (2.7.0) Using rack (1.5.2) Using rack-test (0.6.2) Using actionpack (4.0.0) Using mime-types (1.25) Using polyglot (0.3.3) Using treetop (1.4.15) Using mail (2.5.4) Using actionmailer (4.0.0) Using activemodel (4.0.0) Using activerecord-deprecated_finders (1.0.3) Using arel (4.0.0) Using activerecord (4.0.0) Using thor (0.18.1) Using railties (4.0.0) Using sass (3.2.12) Using anjlab-bootstrap-rails (3.0.0.3) from git://github.com/anjlab/bootstrap-rails.git (at master) Using climate_control (0.0.3) Using cocaine (0.5.2) Using coffee-script-source (1.6.3) Using execjs (2.0.2) Using coffee-script (2.2.0) Using coffee-rails (4.0.0) Using hike (1.2.3) Using jbuilder (1.5.1) Using jquery-fileupload-rails (0.4.1) Using jquery-rails (3.0.4) Using json (1.8.0) Using paperclip (3.5.1) Using bundler (1.3.5) Using tilt (1.4.1) Using sprockets (2.10.0) Using sprockets-rails (2.0.0) Using rails (4.0.0) Using rdoc (3.12.2) Using sass-rails (4.0.0) Using sdoc (0.3.20) Using sqlite3 (1.3.8) Using turbolinks (1.3.0) Using uglifier (2.2.1) Your bundle is complete! Use bundle show [gemname] to see where a bundled gem is installed. ml in /Users/ml/rails-multimodel-upload-demo (17 entries, 2 hidden) 85 585 $ rake db:migrate == CreateItems: migrating ==================================================== -- create_table(:items) -> 0.0011s == CreateItems: migrated (0.0012s) ===========================================

== CreateUploads: migrating ================================================== -- create_table(:uploads) -> 0.0009s == CreateUploads: migrated (0.0010s) =========================================

== AddAttachmentUploadToUploads: migrating =================================== -- change_table(:uploads) -> 0.0018s == AddAttachmentUploadToUploads: migrated (0.0019s) ==========================

ml in /Users/ml/rails-multimodel-upload-demo (17 entries, 2 hidden) 86 586 $ rails s => Booting WEBrick => Rails 4.0.0 application starting in development on http://0.0.0.0:3000 => Run rails server -h for more startup options => Ctrl-C to shutdown server [2013-12-13 02:23:12] INFO WEBrick 1.3.1 [2013-12-13 02:23:12] INFO ruby 2.0.0 (2013-06-27) [x86_64-darwin12.3.0] [2013-12-13 02:23:12] INFO WEBrick::HTTPServer#start: pid=13505 port=3000

Started GET "/" for 127.0.0.1 at 2013-12-13 02:23:19 +1100 ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations" Processing by ItemsController#index as HTML Item Load (0.1ms) SELECT "items".* FROM "items" Rendered items/index.html.erb within layouts/application (3.5ms) Completed 200 OK in 2587ms (Views: 2569.7ms | ActiveRecord: 0.4ms)

Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/uploads.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery.fileupload-ui.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/items.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/items.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/uploads.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/transition.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/button.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/carousel.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/collapse.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/alert.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/dropdown.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/popover.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/tooltip.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/affix.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/tab.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/modal.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap/scrollspy.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/holder.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/vendor/load-image.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/vendor/jquery.ui.widget.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/twitter/bootstrap.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/vendor/canvas-to-blob.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/vendor/tmpl.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-fp.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/jquery.iframe-transport.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/locale.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-ui.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/jquery-fileupload/index.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:22 +1100

Started GET "/items/new" for 127.0.0.1 at 2013-12-13 02:23:24 +1100 Processing by ItemsController#new as HTML Rendered items/_form.html.erb (48.5ms) Rendered items/new.html.erb within layouts/application (51.0ms) Completed 200 OK in 62ms (Views: 60.9ms | ActiveRecord: 0.1ms)

Started GET "/items/new" for 127.0.0.1 at 2013-12-13 02:23:24 +1100 Processing by ItemsController#new as HTML Rendered items/_form.html.erb (2.7ms) Rendered items/new.html.erb within layouts/application (4.0ms) Completed 200 OK in 16ms (Views: 14.9ms | ActiveRecord: 0.0ms)

Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/uploads.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/items.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery.fileupload-ui.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/items.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/uploads.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/transition.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/button.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/alert.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/carousel.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/collapse.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/dropdown.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/popover.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/scrollspy.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/modal.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/tooltip.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/tab.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap/affix.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/holder.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/twitter/bootstrap.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/vendor/jquery.ui.widget.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/vendor/canvas-to-blob.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/vendor/load-image.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/vendor/tmpl.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/jquery.iframe-transport.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-fp.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-ui.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/locale.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/jquery-fileupload/index.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started GET "/items" for 127.0.0.1 at 2013-12-13 02:23:25 +1100 Processing by ItemsController#index as JSON Item Load (0.1ms) SELECT "items".* FROM "items" Rendered items/index.json.jbuilder (2.8ms) Completed 200 OK in 9ms (Views: 8.5ms | ActiveRecord: 0.1ms)

Started GET "/assets/twitter/glyphicons-halflings-regular.woff" for 127.0.0.1 at 2013-12-13 02:23:25 +1100

Started POST "/items" for 127.0.0.1 at 2013-12-13 02:23:37 +1100 Processing by ItemsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"HL0VRL0Uj22u/hXwjHGCrYxZABh43cKgTxyZ7W30Uls=", "item"=>{"name"=>"Item_name_1", "model"=>"Model_name_1", "price"=>"100"}} (0.3ms) begin transaction SQL (3.3ms) INSERT INTO "items" ("created_at", "model", "name", "price", "updated_at") VALUES (?, ?, ?, ?, ?) ["created_at", Thu, 12 Dec 2013 15:23:37 UTC +00:00], ["model", "Model_name_1"], ["name", "Item_name_1"], ["price", 100], ["updated_at", Thu, 12 Dec 2013 15:23:37 UTC +00:00] commit transaction Redirected to http://localhost:3000/items/1 Completed 302 Found in 11ms (ActiveRecord: 4.3ms)

Started GET "/items/1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100 Processing by ItemsController#show as HTML Parameters: {"id"=>"1"} Item Load (0.2ms) SELECT "items".* FROM "items" WHERE "items"."id" = ? LIMIT 1 [["id", "1"]] Rendered items/show.html.erb within layouts/application (0.8ms) Completed 200 OK in 16ms (Views: 13.1ms | ActiveRecord: 0.2ms)

Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/uploads.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/jquery.fileupload-ui.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/items.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/carousel.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/uploads.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/items.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/button.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/alert.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/transition.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/collapse.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/dropdown.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/modal.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/tooltip.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/tab.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/popover.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/scrollspy.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap/affix.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/holder.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/jquery-fileupload/vendor/jquery.ui.widget.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:37 +1100

Started GET "/assets/twitter/bootstrap.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/jquery-fileupload/vendor/load-image.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/jquery-fileupload/vendor/canvas-to-blob.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/jquery-fileupload/vendor/tmpl.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/jquery-fileupload/jquery.iframe-transport.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-fp.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-ui.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/jquery-fileupload/locale.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/assets/jquery-fileupload/index.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:38 +1100

Started GET "/items/1/edit" for 127.0.0.1 at 2013-12-13 02:23:40 +1100 Processing by ItemsController#edit as HTML Parameters: {"id"=>"1"} Item Load (0.1ms) SELECT "items".* FROM "items" WHERE "items"."id" = ? LIMIT 1 [["id", "1"]] Rendered items/_form.html.erb (2.0ms) Rendered items/edit.html.erb within layouts/application (3.2ms) Completed 200 OK in 13ms (Views: 11.9ms | ActiveRecord: 0.1ms)

Started GET "/items/1/edit" for 127.0.0.1 at 2013-12-13 02:23:40 +1100 Processing by ItemsController#edit as HTML Parameters: {"id"=>"1"} Item Load (0.1ms) SELECT "items".* FROM "items" WHERE "items"."id" = ? LIMIT 1 [["id", "1"]] Rendered items/_form.html.erb (2.3ms) Rendered items/edit.html.erb within layouts/application (3.6ms) Completed 200 OK in 16ms (Views: 14.0ms | ActiveRecord: 0.1ms)

Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/items.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/uploads.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery.fileupload-ui.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/items.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/uploads.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/transition.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/alert.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/button.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/carousel.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/collapse.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/dropdown.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/modal.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/scrollspy.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/tooltip.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/popover.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/tab.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap/affix.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/twitter/bootstrap.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/holder.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/vendor/jquery.ui.widget.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/vendor/load-image.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/vendor/canvas-to-blob.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/vendor/tmpl.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/jquery.iframe-transport.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-fp.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-ui.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/locale.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/jquery-fileupload/index.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100

Started GET "/items/1" for 127.0.0.1 at 2013-12-13 02:23:40 +1100 Processing by ItemsController#show as JSON Parameters: {"id"=>"1"} Item Load (0.1ms) SELECT "items".* FROM "items" WHERE "items"."id" = ? LIMIT 1 [["id", "1"]] Rendered items/show.json.jbuilder (1.3ms) Completed 200 OK in 9ms (Views: 7.0ms | ActiveRecord: 0.1ms)

Started PATCH "/items/1" for 127.0.0.1 at 2013-12-13 02:23:48 +1100 Processing by ItemsController#update as JSON Parameters: {"utf8"=>"✓", "authenticity_token"=>"HL0VRL0Uj22u/hXwjHGCrYxZABh43cKgTxyZ7W30Uls=", "item"=>{"name"=>"Item_name_1", "model"=>"Model_name_1", "price"=>"100", "uploads_attributes"=>[{"upload"=>#<ActionDispatch::Http::UploadedFile:0x007fcaa22a0098 @tempfile=#<Tempfile:/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/RackMultipart20131213-13505-1gggd9f>, @original_filename="disi-162-001.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"item[uploads_attributes][][upload]\"; filename=\"disi-162-001.jpg\"\r\nContent-Type: image/jpeg\r\n">}, {"upload"=>#<ActionDispatch::Http::UploadedFile:0x007fcaa22aa458 @tempfile=#<Tempfile:/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/RackMultipart20131213-13505-16fag7n>, @original_filename="disi-162-002.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"item[uploads_attributes][][upload]\"; filename=\"disi-162-002.jpg\"\r\nContent-Type: image/jpeg\r\n">}, {"upload"=>#<ActionDispatch::Http::UploadedFile:0x007fcaa22ab380 @tempfile=#<Tempfile:/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/RackMultipart20131213-13505-11b4953>, @original_filename="disi-162-003.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"item[uploads_attributes][][upload]\"; filename=\"disi-162-003.jpg\"\r\nContent-Type: image/jpeg\r\n">}]}, "id"=>"1"} Item Load (0.1ms) SELECT "items".* FROM "items" WHERE "items"."id" = ? LIMIT 1 ["id", "1"] begin transaction Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/disi-162-00120131213-13505-3l21e.jpg[0]' [paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick.> Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/disi-162-00120131213-13505-3l21e.jpg[0]' [paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick.> Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/disi-162-00120131213-13505-3l21e.jpg[0]' [paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick.> Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/disi-162-00220131213-13505-jsrzyf.jpg[0]' [paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick.> Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/disi-162-00220131213-13505-jsrzyf.jpg[0]' [paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick.> Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/disi-162-00220131213-13505-jsrzyf.jpg[0]' [paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick.> Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/disi-162-00320131213-13505-14oihde.jpg[0]' [paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick.> Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/disi-162-00320131213-13505-14oihde.jpg[0]' [paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick.> Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/jw/9mt_f0m50nndtdcztd0p_3nc0000gn/T/disi-162-00320131213-13505-14oihde.jpg[0]' [paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the identify command. Please install ImageMagick.> (0.1ms) rollback transaction Completed 422 Unprocessable Entity in 179ms (Views: 0.3ms | ActiveRecord: 0.6ms)

Started GET "/" for 127.0.0.1 at 2013-12-13 02:23:49 +1100 Processing by ItemsController#index as HTML Item Load (0.2ms) SELECT "items".* FROM "items" Upload Load (1.2ms) SELECT "uploads".* FROM "uploads" WHERE "uploads"."item_id" = ? [["item_id", 1]] Rendered items/index.html.erb within layouts/application (8.2ms) Completed 200 OK in 32ms (Views: 29.0ms | ActiveRecord: 1.4ms)

Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/uploads.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/items.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery.fileupload-ui.css?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/items.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/uploads.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/transition.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/alert.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/button.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/carousel.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/dropdown.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/collapse.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/tooltip.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/scrollspy.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/modal.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/holder.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/tab.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/affix.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/twitter/bootstrap/popover.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/vendor/jquery.ui.widget.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/vendor/load-image.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/vendor/canvas-to-blob.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/vendor/tmpl.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/jquery.iframe-transport.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-fp.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/jquery.fileupload-ui.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/locale.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/jquery-fileupload/index.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100

Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-12-13 02:23:49 +1100 ^C[2013-12-13 02:24:48] INFO going to shutdown ... [2013-12-13 02:24:48] INFO WEBrick::HTTPServer#start done. Exiting ml in /Users/ml/rails-multimodel-upload-demo (18 entries, 2 hidden)

1 501 $ rails c Loading development environment (Rails 4.0.0) 2.0.0p247 :001 > Item.all Item Load (0.1ms) SELECT "items".* FROM "items" => #<ActiveRecord::Relation [#<Item id: 1, name: "Item_name_1", model: "Model_name_1", price: 100, created_at: "2013-12-12 15:23:37", updated_at: "2013-12-12 15:23:37">]> 2.0.0p247 :002 > Upload.all Upload Load (0.1ms) SELECT "uploads".* FROM "uploads" => #<ActiveRecord::Relation []> 2.0.0p247 :003 > On 13 Dec 2013, at 12:51 am, goooseman notifications@github.com wrote:

Strange behaviour. I've just tested it on a clean install with ruby 2.0 and everything works fine. I can see my uploaded images in Items and upload new ones. Uploaded images are saved in public/system/uploads Did you get any errors in log?

— Reply to this email directly or view it on GitHub.

goooseman commented 10 years ago

OK, i found your problem. This project is using paperclip gem. And paperclip gem requires ImageMagick to be installed on your system.

As I can see, you are on OSX. On OSX the easiest way to install ImageMagick is to use Homebrew. After installing Homebrew you can install ImageMagick with brew install imagemagick

goooseman commented 10 years ago

Write me down if everything will be OK

ssipin commented 10 years ago

thank you, I installed Imagemagick, it works now.

However, it doesn’t upload other file types, I was hoping to adapt your solution to my needs.

What I want to do is to be able to attach pdf, doc, xls or msg files and save each of these attachments under each item_id, any chance you can help me on that?

I have experimented with Carrierwave, but so far I can only store 1 file per item_id, unfortunately my legacy app often have two or more file attachments stored under the same item_id, as I would like to port these into new app, you can imaging how tedious it is having to add file names to the database, it would be good to just auto discover these old data, and presented in item View as links.

Any thoughts on this is hugely appreciated.

Cheers.

On 13 Dec 2013, at 2:54 am, goooseman notifications@github.com wrote:

OK, i found your problem. This project is using paperclip gem. And paperclip gem requires ImageMagick to be installed on your system.

As I can see, you are on OSX. On OSX the easiest way to install ImageMagick is to use Homebrew. After installing Homebrew you can install ImageMagick with brew install imagemagick

— Reply to this email directly or view it on GitHub.

goooseman commented 10 years ago

Firstly, paperclip uses image pre-processor, so you can add

before_post_process :disable
def disable
  return false
end

to your modal to disable pre-processor. So your modal will look like this:

class Upload < ActiveRecord::Base
    belongs_to :item
    has_attached_file :upload, :styles => { :large => "800x800", :medium => "400x400>", :small => "200x200>" }
  before_post_process :disable

  def disable
    return false
  end
end

Secondly, you need to edit items/index.html.erb to show link, not image:

<td>
<% item.uploads.each do |p| %>
        <a href="<%= p.upload.url %>">link</a>       
<% end %>
</td>