M
M
Max2015-05-14 16:53:34
Ruby on Rails
Max, 2015-05-14 16:53:34

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

2 answer(s)
A
Andrey Andreev, 2015-05-14
@maxprof

What I love about Rails is the detailed error log.
It is written to you:
So @productyour 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| %>

S
Shaks, 2015-05-14
@shaks

well means at you @productcontains or nil or empty.
in the console (provided by the 'web-console' gem @productand make sure that it is either nil or empty
if you don't understand what console we are talking about, then I'm talking about this one:
friz7OO.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question