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.
Asked
Active
Viewed 375 times
1
-
Can you try replacing `f.collection_select(:conf, Container.all, ...)` with `f.collection_select(:conf[], Container.all, ...)`? Does this work? – Aakanksha Feb 13 '18 at 05:25
-
@Aakanksha, im getting the wrong number of attributes error – Gunther Gib Feb 13 '18 at 05:40
1 Answers
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
-