Ok, the problem is trying to render a form from a controller to create a new entry.. For that im calling the default form that comes with the scaffold creation
I’m trying to make it like this:
<%= render :partial => 'contactos/form' %>
And im getting the following error
undefined method 'model_name' for NilClass:Class
Is there any way of just rendering from the view itself?
If there is not… Which parameters should I add to the controller?
Right now I just have following code:
Class DisplayController < ApplicationController
def index
@contactos = Contacto.all
end
end
*This is the view controller, not the one with the create update and edit functions from my scaffold
Ok, I’ve done a very large research but no answer can fix my problem. (This is the first time I ask something, sorry in advance for any mistake I could make)
The problem is that the variable your are using in the form for your contact doesn’t exist. The only variable you created in the index action is an array of all the contacts, but the form needs a single instance of a single contact.
Because you are making a new contact, you have to do something like this in the action index: