How to have a drop down <select> field in a rails form?

前端 未结 8 1703
终归单人心
终归单人心 2020-12-02 06:23

I am creating a scaffold -

rails g scaffold Contact email:string email_provider:string 

but I want the email provider to be a drop down (wi

8条回答
  •  粉色の甜心
    2020-12-02 06:57

    Please have a look here

    Either you can use rails tag Or use plain HTML tags

    Rails tag

    <%= select("Contact", "email_provider", Contact::PROVIDERS, {:include_blank => true}) %>
    

    *above line of code would become HTML code(HTML Tag), find it below *

    HTML tag

    
    

提交回复
热议问题