administrate icon indicating copy to clipboard operation
administrate copied to clipboard

Field Select - Default selected option not working

Open shivamvinsol opened this issue 1 year ago • 1 comments

Hi, I am using Field::Select and need to show a option as selected by default. I read the guides and it mentioned that the collection param has the same format as Rails options_for_select

options_for_select does allow selecting a option and I tried the following

collection: [['Apple', 'Ball', 'Cat'], 'Ball']
collection: [{ Apple: 1,  Ball: 2 }, 2]
collection: ['Apple', 'Ball'], selected: 'Ball'

But none of these worked. Is there a way to do this, or do I need to add a custom field for this?

Thanks and apologies if this issue was raised earlier.

Rails - 7.1.3 Administrate - 0.18

shivamvinsol avatar May 23 '24 12:05 shivamvinsol

I've made a PR for this issue:

https://github.com/thoughtbot/administrate/pull/2676

Thrizian avatar Oct 06 '24 15:10 Thrizian