Why is the first element always blank in my Rails multi-select, using an embedded array?

后端 未结 9 2364
我寻月下人不归
我寻月下人不归 2020-11-29 19:54

I\'m using Rails 3.2.0.rc2. I\'ve got a Model, in which I have a static Array which I\'m offering up through a form such that users may se

9条回答
  •  [愿得一人]
    2020-11-29 20:19

    I make it work by writing this in the Javascript part of the page:

    $("#model_subset_array").val( <%= @model.subset_array %> );
    

    Mine looks more like following:

    $("#modela_modelb_ids").val( <%= @modela.modelb_ids %> );
    

    Not sure if this is going to get me headache in the future but now it works fine.

提交回复
热议问题