I have a collection_select with options from other model, and I need to show in the dropdown and in selected value different attributes. I.e I need to show in dropdown object.title but the selected value should show object.code.
I have a code:
f.collection_select :some_attribute_id, Country.all, :id, :title
Currently showing values in dropdown and showing selected value are the same attribute. I have tried to do something like
f.collection_select :some_attribute_id, Country.all, :id, :title, { prompt: @object.country.code }
or selected: @object.country.code but unsuccessful