0

For json

{ "version":"1", "configs":[ { "title":"Good", "body":"Body" }, { "title":"Good", "body":"Body" } ] } 

How to permit it with Rails' params.permit in controller?

I tried

 params.permit( config_setting: [ :version, configs: [ :title, :body, ] ], ) 

But seems not right.

1 Answer 1

2

Currently you are permitting a json with the following structure:

{ "config_setting": [ { "version":"1", "configs":[ { "title":"Good", "body":"Body" }, { "title":"Good", "body":"Body" } ] } ] } 

Just add config_setting node to the data or adjust your strong params block to:

params.permit( :version, configs: [ :title, :body, ] ) 
Sign up to request clarification or add additional context in comments.

1 Comment

Actually, it is an array of config_setting

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.