samedi 27 juin 2015

Why does form_for(@object) do |f| work in the _form.html.erb but not in the index.html.erb

Ok, So i'm trying to place the form found in the _form.html.erb in my index.html.erb of my ruby project crashes with the error

"First argument in form cannot contain nil or be empty"

<%= form_for(@customer) do |f| %>

I know that changing the @customer to Customer.new could fix this but I would like to know why this isn't necessary in one file and it is in another

Why is this happening and how do I make a form that will update the sqlite db on the index page.

Aucun commentaire:

Enregistrer un commentaire