jeudi 16 septembre 2021

How can show the drop down value against the enum value

status is a drop down having values (new, started, completed) if it’s a feature or (new, started and resolved) if it’s a bug. I don't know how can i do this

Model

Class Task
  enum typeOf: %i[feature bug]
  enum status_is: %i[New started completed resolved]
end

erb.html

<%= form_for :task, url: project_tasks_path, :html => {:multipart => true, :cla

   <%= f.hidden_field :project %>
   Title: <%=f.text_field :title, class:"form-control" %><br>
   Description: <%=f.text_field :description, class:"form-control" %><br>
   <label for="deadline">Deadline</label><input type="datetime-local" id="deadline"
                                         name="deadline" ><br>
   Screen Shot: <%=f.file_field :screen_shot, multiple: true, class:"form-control" %>
   <div class="field">
     <%= f.label :typeOf, class:"form-control" %><br />
     <%= f.select(:typeOf, Task.typeOfs.keys.map {|role| [role.titleize,role]}) %>
   </div>

   <div class="field">
     <%= f.label :status_is, class:"form-control" %><br />
     <%= f.select(:status_is, Task.status_is.keys.map {|role| [role.titleize,role]}) %>
   </div>
   <%= f.submit "Add" %>

<%end %>

Aucun commentaire:

Enregistrer un commentaire