ruby-on-railscollection-select

Getting unpermitted parameter using collection_select with multiple => true


Console and the view

I have two models with no associations between them. I am fetching the list of names as options for selection to the primary model. Collection_select without multiple => true works as expected. But when i add multiple i get the unpermitted parameter error.


Solution

  • Because :conf_string is an array, so you need to permit it as an array.

    In your BaseTablesController:

    def base_table_params
      params.require(:base_table).permit(:name, conf_string: [])
    end
    

    Don't forget to update :conF_string to :conf_string. I think you made a typing mistake