Answer the question
In order to leave comments, you need to log in
How to render a form in rails?
And so the code is new.html.erb: pastebin.com/rUCJxsWs
The code is index.html.erb pastebin.com/rGcmX3P6
The code is application.html.erb pastebin.com/rGcmX3P6
And the forms themselves are: pastebin.com/95tmN2uu
The code of the products pastebin controller. com/syVm3gh3
When I call render on the index.html.erb page, this error pops up. When I
call it only on the new.html.erb page, there is no error and the variable is not empty.
Answer the question
In order to leave comments, you need to log in
What I love about Rails is the detailed error log.
It is written to you:
So @product
your variable is empty.
Why? Perhaps you did not create it in the controller, you already know better.
You can try like this:<%= form_for(Product.new) do |f| %>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question