Forum: Ruby on Rails NoMethodError

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
oreo (Guest)
on 2005-12-10 12:00
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.
peter.j.donald (Guest)
on 2005-12-10 12:08
(Received via mailing list)
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
oreo <> (Guest)
on 2005-12-11 00:02
awesome - you were correct. login was a field that was no longer being
used. Thanks!!!
This topic is locked and can not be replied to.