I need to include a select list in my get request to the new_item_path The problem I'm having is it doesn't send the intended resource object, in this case:item back to the controller so item_params doesn't have item prepended to it
param is missing or the value is empty: item
<%= form_tag new_item_path(@item), :method => :get do %>
<div class="field">
<%= select_tag(:item_type, options_for_select(Item::ITEM_TYPES)) %>
</div>
<div class="actions">
<%= submit_tag "New item" %>
</div>
<% end %>
Change your code in select_tag to <%= select_tag("item[item_type]", options_for_select(Item::ITEM_TYPES)) %>
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.