1

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.

Gunther Gib
  • 117
  • 10

1 Answers1

2

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

fongfan999
  • 2,565
  • 1
  • 12
  • 21
  • Thanks a lot, its working now. But i have a doubt, can i make multiple selection return binary values on selection. for example the selected options return 1 others return 0. So the value inserted to the database will be of format "101101" string. – Gunther Gib Feb 13 '18 at 07:00
  • Using `unpack(B*)`, ie: `'1'.unpack('B*') # => ["00110001"]` – fongfan999 Feb 13 '18 at 20:04