ruby on rails - how to set a default 'selected value' on a :collection dropdown/select textfield? -


I'm choosing drop down / textfield / trying to select a certain value in the default. I've tried many options to make no profit, from the profile model to the default, how to set the default, who knows?

  = f.input_field: state_id ,: label = & gt; "Your State" ,: Archive = & gt; DataState.Al ,: default = & gt; [DataStat: where (: id = & gt; @ user.profile.state_id)] ​​,: style = & gt; "Width: 110px! Important"   

I'm using simple_form

Have you tried using the : selected option?

Try changing it:

 : default = & gt; [DataState.where (: id = & gt; @ user.profile.state_id)],   

for

 : selected => [DataStat. (There (= id = & gt; @ user.profile.state_id]],    

Comments