Ruby on Rails
Friday, October 4, 2019
<%= form_tag new_item_path, :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>
ActionController::ParameterMissing in ItemsController#new
param is missing or the value is empty: item
In my controller I have the usual filter
def item_params
params.require(:item).permit(:item_type, :title, :item_id, item_ids: [])
end
...params.require(:item).permit(:item_type, :title, :item_id, item_ids: [])
end
Started GET "/items/new?item_type=General&commit=New+item&utf8=%E2%9C%93" for 127.0.0.1 at 2019-10-04 03:32:18 -0400
Processing by ItemsController#new as HTML
Parameters: {"item_type"=>"General", "commit"=>"New item", "utf8"=>"✓"}
Completed 400 Bad Request in 2ms (ActiveRecord: 0.0ms)
ActionController::ParameterMissing (param is missing or the value is empty: item):
app/controllers/items_controller.rb:109:in `item_params'
app/controllers/items_controller.rb:23:in `new'
...
Parameters: {"item_type"=>"General", "commit"=>"New item", "utf8"=>"✓"}
Completed 400 Bad Request in 2ms (ActiveRecord: 0.0ms)
ActionController::ParameterMissing (param is missing or the value is empty: item):
app/controllers/items_controller.rb:109:in `item_params'
app/controllers/items_controller.rb:23:in `new'
...
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bf023a9a-c12b-41be-969f-eb13342bbd84%40googlegroups.com.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment