如何允许使用强参数 gem 的自定义参数?

How to permit custom params using strong parametes gem?

我得到的参数如下。

 {"utf8"=>"✓", "authenticity_token"=>"auth_token=", "js_data_entry"=>[{"data_entry"=>[{"name"=>"test_book22", "node_id"=>"65", "field_type"=>"Text", "options_attributes"=>[{"option_value"=>""}], "location"=>"Body", "rank"=>"", "must_fill"=>"0", "multi"=>"0", "role"=>["4"], "update_db"=>"vocation.name", "select_db"=>""}], "js_editor"=>[{"field_id"=>"", "field_class"=>"", "js_code"=>""}]}], "node_id"=>"65", "commit"=>"Submit", "action"=>"create", "controller"=>"data_entries"}

我尝试如下允许参数

 def entry_params
   params.require(:js_data_entry).permit([:node_id, :field_type, :name, :location, :rank, :multi, :must_fill, :update_db, :select_db, :role, :options_attributes])
 end

但它正在抛出

undefined method `permit' for #<Array:0xc603e78>

请帮我解决这个问题。

我按如下方式修复了问题..

 params.require(:js_data_entry)[0].permit(:data_entry=>[:node_id, :field_type, :name, :location, :rank, :multi, :must_fill, :update_db, :select_db, :role=>[], :options_attributes=>[:option_value]], :js_editor=>[:field_id,:field_class,:js_code])