Home create permitted attributes for my form post
Reply: 0

create permitted attributes for my form post

user1072
1#
user1072 Published in May 21, 2018, 10:31 pm

I have the following output from my form post and I want to create permitted attributes but I am not able to get it to work and a little confused.

POST data:-

Parameters: {"utf8"=>"✓", "authenticity_token"=>"nUAxX0FRhqhS+u8zTUcvogtHf8KPhcriNK95zLL0mAwd+/CyUrq80+wdq68c/h2MrBWvvTdBYwHv3IKH29ZcWQ==", "quiz"=>{"name"=>"Questions Testing", "questions_attributes"=>{"0"=>{"question_name"=>"Question # 1", "answer1"=>"", "answer2"=>"", "answer3"=>"", "answer4"=>"", "correct_answer"=>""}, "1"=>{"question_name"=>"", "answer1"=>"", "answer2"=>"", "answer3"=>"", "answer4"=>"", "correct_answer"=>""}}}, "commit"=>"Create Quiz"}

error:- Unpermitted parameter: questions_attributes

What I have tried is

params.require(:quiz).permit(:name, questions_attributes: [{0: [:question_name, :answer1, :answer2, :answer3, :answer4]}])

And I am not able to understand , how to get this to work so any help will be highly appreciated

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322465 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO