Below is the ERB for a new 'To-do' view. Duedate is another table that holds date objects, and there is an association between duedates and todos with a 'duedate_id' in the todo table. Right now there is just a dropdown for any externally created duedates. While creating a new todo, I would like the option to EITHER select a previously created duedate from the drop-down menu or create a new duedate on the spot, and then be able to select it from the dropdown list. Is this possible?
<h1>New todo</h1>
<% form_for(@todo) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :todo %><br />
<%= f.text_field :todo %>
</p>
<p>
<%= f.label :priority %><br />
<%= f.collection_select :priority_id, Priority.find(:all), :id, :priority%>
</p>
<p>
<%= f.label :duedate %><br />
<%= f.collection_select :duedate_id, Duedate.find(:all), :id, :duedate %>
</p>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
<%= link_to 'Back', todos_path %>