0

I am getting params as follows.

 {"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"}

I tried to permit params as follows

 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

but it's throwing

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

Please help me to fix this issue.

mu is too short
  • 426,620
  • 70
  • 833
  • 800
Can Can
  • 3,644
  • 5
  • 32
  • 56

1 Answers1

0

I fixed the issue as follows..

 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])
Can Can
  • 3,644
  • 5
  • 32
  • 56