how to use form_with

Trying to build a rails 5.2 form using form_with I get this error: ActionView::Template::Error (wrong number of arguments (given 1, expected 0)):

<%= form_with @item, url: new_item_path, method: ‘get’ do |f| %>

 <div class="field">
    <%= f.select :item, :item_type_id, ItemType.all, :id, :name %>
 </div>

<div class="actions">
    <%= f.submit "New item" %>
</div>

<% end %>

Have you read the Rails API docs and Rails Guides for usage of form_with?

https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_with

https://guides.rubyonrails.org/form_helpers.html

Yea

<%= form_with(model: @item, url: new_item_path(@item), method: “get”) do |f| %>

 <div class="field">
    <%= f.select :item, :item_type_id, ItemType.all, :id, :name %>
 </div>

<div class="actions">
    <%= f.submit "New item" %>
</div>

<% end %>

ActionView::Template::Error (wrong number of arguments (given 5, expected 1…4)):

Which item in the code you shared is being given five arguments? Look there. (It's not the form_for.)

Walter