The error message is telling you that you can't have the following:
<%= form_for nil do |f| %>
<%= form_for [] do |f| %>
My guess here is that your @contact
is set to nil
and that it doesn't come from your Contact#new
action.
FYI it would simply work if you do this:
<%= form_for Contact.new do |f| %>
Though it is not recommended.
You need to check that the view containing your form is actually rendered by the new
action of your ContactsController
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…