ruby on rails - How to control :selected for collection_select? -
currently if call @team.user_ids
returns "1,3,7"
opposed [1,3,7]
. need other reasons, it's breaking front-end collection_select
. i've tested , works fine array, step left manually choose items selected considering can't rails default way.
= f.collection_select :user_ids, @company.users, :id, :username, { :include_blank => true }, { :multiple => true, :class => "chzn-select" }
how go doing this? thanks!
i solved adding :selected => @team.users.map(&:id)
Comments
Post a Comment