Closed sonq closed 5 years ago
Could you show us the part of the logfile, I would like to see what is posted to the controller and the possible error, if any?
nathanvda please find log, it shows no error or rollback but it does not attempt to save dietlines as i see.
Started POST "/diets" for 127.0.0.1 at 2019-02-25 11:21:44 +0300
Processing by DietsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"VbLYy1T7YL3ZNxEvKgKWq6En6luYivvv8ouyqQmJePlESVePrTWyJ/f7KYGUUDCLxwEPknFaxNhS/gn3RYNu+A==", "diet"=>{"die_desc"=>"test", "die_type"=>"Keto", "die_text"=>""}, "commit"=>"Create Diet"}
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 8], ["LIMIT", 1]]
↳ /Users/sonerkurceren/.rvm/rubies/ruby-2.4.2/lib/ruby/gems/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13
(0.2ms) BEGIN
↳ app/controllers/diets_controller.rb:30
Type Load (0.3ms) SELECT "types".* FROM "types" WHERE "types"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
↳ app/controllers/diets_controller.rb:30
Diet Create (0.3ms) INSERT INTO "diets" ("die_desc", "die_text", "type_id", "user_id", "die_type") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["die_desc", "test"], ["die_text", ""], ["type_id", 1], ["user_id", 8], ["die_type", "Keto"]]
↳ app/controllers/diets_controller.rb:30
(2.0ms) COMMIT
↳ app/controllers/diets_controller.rb:30
Redirected to http://localhost:3000/diets/36/edit
Completed 302 Found in 8ms (ActiveRecord: 3.2ms)
Did you notice in the post-params it does not contain any child-data? This seems to suggest your html is incorrect, possibilities:
I am guessing in this case you will have to look at the first?
Dear Nathanvda,
thanks for your helps, i deleted all the divs and wrote them one by one. Now it works.
Thanks.
Great work! :clap: :clap:
Hello there!
I know there are millions of issues like this and i know the issue is related to either a typo mistake or something about divs but i just cannot find it or i made another mistake and i cannot find it. So, please help me out.
Here is my model for parent form
and this is model of the nested form
and here are my strong params
this is the _form view
and finally this is the cocoon fields partial
any help will be appreciated!