Haseeb Ahmad
Haseeb Ahmad

Reputation: 8740

How to make an option preselected in dropdown - activeadmin

f.input :country_id, :prompt => 'Select Country', :as => :select, :collection => Country.all.map{|m| [m.name, m.id]} }

How to make one of the options from dropdown to be preselected. For example to select the value with id 5 what should be done?

Upvotes: 3

Views: 1500

Answers (1)

Hardik Upadhyay
Hardik Upadhyay

Reputation: 2659

Try this,

f.input :country_id, label: 'country', :as => :select, :collection => Country.all.map{|m| [m.name, m.id]},include_blank: false 

just include 'include_blank:' parameter

Hope its work

Upvotes: 4

Related Questions