Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これを行う方法がわかりません。テキスト フィールドではなく、フィールドにドロップ ダウン リスト ボックスを表示したいだけです。プロファイル モデルの国列にドロップ ダウン リストを表示したいです。
モデルに定数を作成します。
COUNTRIES = ["Democratic", "Republic"]
次に、ビューで、フォームにドロップダウン リストを作成し、定数を使用して入力します。
このようなもの:
= f.select :country, ModelName::COUNTRIES, { prompt: "Select Country" }