Home>

I want to pass parameters and save the orders table.
There are only two columns in the orders table, the reference type user_id and skin_id.
The unit test code for the model has been successful.

ActionController :: ParameterMissing in OrdersController # create
param is missing or the value is empty: order
Parameters:
{"authenticity_token" =>"n + UDKUpJfOpLQDuYlrD + YUjFOT9APvqfKso9w + 3pUXKwlCXnWjsW5UDt6Xpn3P // yH6XodvDG9P4Kk0O7vK18g ==", "commit" == "," commit "="
order_controllers
class OrdersController</pre>
<strong>orders/index.html.erb</strong>
<pre><code data-language = "Ruby">
<% = image_tag (url_for (controller:: skins, action:: show, id: @ skins.id))%>
<% = @ skins.medal%>


<% = form_with url: "/skins/#{@skins.id}/orders", model: @order, local: true do | f |%>

<% = f.submit "Buy", class: "send-btn"%>

<% end%>
What I tried

I checked the association, but it seems that there is no problem.
I thought it was a mistake in the arguments and strong parameters, and tried trial and error, but I couldn't find the cause.
I would appreciate it if you could teach me what is wrong.
If i have the necessary source code, we will provide it all.

Supplementary information (FW/tool version, etc.)

rails6

  • Answer # 1

    Probably
    Since there is no input tag (f.text_field etc.) after form_with, it seems that the cause is that params is empty.
    Please try it once.

Related articles