Permitting nested parameters in Rails
<p>I want to permit a long params hash, I tried to follow <a href="https://github.com/rails/strong_parameters#nested-parameters" rel="nofollow">strong params docs on nested params</a>, but I got a few errors, I can't find what is wrong.</p>

<pre><code>def project_params
  params.require(:project).permit(:name,
                                  :scale,
                                  :unit,
                                  :colorFormat,
                                  :artboards =&gt; [
                                    {
                                      :layers =&gt; [
                                        {
                                          :objectID, :type, :name,
                                          :rect =&gt; {
                                            :x, :y, :width, :height
                                          },
                                          :rotation, :radius, :borders =&gt; [], :fills =&gt; [], :shadows =&gt; [], :opacity, :styleName
                                        }
                                      ],
                                      :notes =&gt; [
                                        {
                                          :rect =&gt; {
                                            :x, :y, :width, :height
                                          },
                                          :note
                                        }
                                      ], :pageName, :pageObjectID, :name, :slug, :objectID, :width, :height, :imagePath
                                    }
                                  ],
                                  :slices =&gt; [
                                    :name, :objectID,
                                    :rect =&gt; {
                                      :x, :y, :width, :height
                                    },
                                    :exportable =&gt; [
                                      {
                                        :name, :density, :format, :path
                                      }
                                    ]
                                  ],
                                  :colors =&gt; [
                                  ]
                                 )
end
</code></pre>

<p>Here are the errors I got:</p>

<pre><code>projects_controller.rb:60: syntax error, unexpected ',', expecting =&gt;
...=&gt; [ {:layers =&gt; [ { :objectID, :type, :name, :rect =&gt; {:x, ...
...                               ^
projects_controller.rb:60: syntax error, unexpected ',', expecting =&gt;
...ID, :type, :name, :rect =&gt; {:x, :y, :width, :height}, :rotat...
...                               ^
projects_controller.rb:60: syntax error, unexpected ',', expecting =&gt;
... } ], :notes =&gt; [{:rect =&gt; {:x, :y, :width, :height}, :note}...
...                               ^
projects_controller.rb:60: syntax error, unexpected ',', expecting =&gt;
...:name, :objectID, :rect =&gt; {:x, :y, :width, :height}, :expor...
...                               ^
projects_controller.rb:60: syntax error, unexpected ',', expecting =&gt;
...eight}, :exportable =&gt; [{:name, :density, :format, :path}], ...
...                               ^):
</code></pre>

<p>I don't know why it's expecting <code>=&gt;</code> instead of <code>,</code> while I just need a scalar value not an array or hash. What I am missing here?</p>

<p><strong>EDIT</strong></p>

<p>Now I fixed most of the params:</p>

<pre><code>  params.require(:project).permit(:slug,
                                  :scale,
                                  :unit,
                                  :color_format,
                                  artboards: [
                                    :page_name, :page_object_id, :name, :slug, :object_id, :width, :height, :image_path,
                                    layers: [
                                      :object_id, :type, :name, :rotation, :radius, :opacity, :style_name, :font_size, :font_face, :text_align, :letter_spacing, :line_height, :content, rect: [], css: [], borders: [], fills: [], shadows: [], color: []
                                    ],
                                    notes: [
                                      :note,
                                      rect: [
                                        :x, :y, :width, :height
                                      ]
                                    ]
                                  ],
                                  slices: [
                                    :name, :object_id,
                                    rect: [
                                      :x, :y, :width, :height
                                    ],
                                    exportable: []
                                  ],
                                  colors: []
                                 )
</code></pre>

<p>I got:</p>

<pre><code>Unpermitted parameter: rect
Unpermitted parameter: rect
Unpermitted parameters: rect, fills
Unpermitted parameters: rect, color
Unpermitted parameters: rect, borders
Unpermitted parameters: rect, color
Unpermitted parameters: exportable, rect
</code></pre>

<p>Here is a sample of a JSON: <a href="https://jsonblob.com/57cb9e08e4b0dc55a4f2b785" rel="nofollow">https://jsonblob.com/57cb9e08e4b0dc55a4f2b785</a></p>