简体   繁体   中英

Ruby on Rails - simple_form - How do I change an input into a multiple choice dropdown?

So I currently have a simple_form set up and one of my inputs is:

<%= form.input :contract, input_html: { maxlength: 60 }, placeholder: "Contract Type", label: false %> 

However I would instead like to change it into a dropdown with 3 options - full time, part time and internship.

What is the correct way to achieve this?

尝试这个

<%= form.input :contract, collection: ['full time', 'part time', 'internship'], input_html: { class: "ui dropdown", maxlength: 60, }, prompt: "Contract Type", label: false %> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM