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.
F2b90f5ca602f5c3272d6ee21784c27a?d=identicon&s=25 oreo (Guest)
on 2005-12-10 11: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.
67b6389be42524fbd776e44fd35c3d7e?d=identicon&s=25 peter.j.donald (Guest)
on 2005-12-10 11: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 Donald

Blog: http://www.RealityForge.org
F2b90f5ca602f5c3272d6ee21784c27a?d=identicon&s=25 oreo <raymondsiu@gmail.com> (Guest)
on 2005-12-10 23: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.