NoMethodError


#1

Hi,

I’m getting NoMethodError when I’m trying to save to the database. Here
is the error.
NoMethodError in Person#create
undefined method `login’ for #Person:0x378b728

The error points to the below def. If I remove the if @person.save
statements, it will run through it without an error.

def create
@person = Person.new(params[:person])
if @person.save
flash[:notice] = ‘Person was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

Hope someone can help. Thanks in advance.


#2

Hi,

You need to provide more information for us to be able to provide
you with a useful answer. I would suggest sending along snippets
relevent Person model, SQL DDL for persons table and a stack
trace. However I suspect that the error you are receiving is because
you are trying to validate a column that does not exist in you database
or in your model.


Cheers,

Peter D.

Blog: http://www.RealityForge.org


#3

awesome - you were correct. login was a field that was no longer being
used. Thanks!!!