Forum: Ruby on Rails [Newbie] undefined method `useremail' error

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.
D2ff155cd04fa175620d2f3495b11b08?d=identicon&s=25 Lorenzo Bolognini (Guest)
on 2006-01-19 03:16
(Received via mailing list)
Hi all,

I'm just starting out... the solution to this must be really trivial but
can't figure out what's wrong. I'm using Webrick + Rails 1.0

The error is:

undefined method `useremail' error

What am I missing?

Thanks,
Lorenzo

class User < ActiveRecord::Base
   set_table_name "\"tblUser\""
   set_primary_key "UserID"

   validates_presence_of :useremail, :userpassword
   validates_confirmation_of :userpassword
end

class UserController < ApplicationController
   def register
     if request.get?
       @user = User.new
     elsif request.post? and @user.save
       User.new(@params[:user])
       flash[:notice] = "User created"
       redirect_to :action => "register"
     else
       flash[:notice] = "Error occurred"
       redirect_to :action => "register"
     end
   end
end

<html>
<head>
<title>Register</title>
</head>
<body>
Register
<form action="register" method="post">
Email: <%= text_field("user", "useremail") %>
Password: <%= text_field("user", "userpassword") %>
Repeat password: <%= text_field_tag(:userpassword_confirmation,
@params[:userpassword_confirmation]) %>
<input type="submit" />
</form>
</body>
</html>

PostgreSQL DDL

CREATE TABLE "public"."tblUser" (
   "UserID" BIGSERIAL,
   "PersonTitleID" BIGINT,
   "SecretQuestionID" BIGINT,
   "UserFirstName" VARCHAR,
   "UserLastName" VARCHAR,
   "UserEmail" VARCHAR NOT NULL,
   "UserPassword" VARCHAR NOT NULL,
   "UserEmailVerified" BOOLEAN DEFAULT false NOT NULL,
   "UserRegistrationDate" DATE,
   "UserPhone" VARCHAR,
   "UserAltPhone" VARCHAR,
   "UserSecretQuestionAnswer" VARCHAR,
   "UserSex" BOOLEAN,
   "UserDateOfBirth" DATE,
   "UserTags" VARCHAR,
   "UserIsBanned" BOOLEAN,
   "UserIsAgent" BOOLEAN,
   "UserCreditLeft" MONEY,
   "UserRating" SMALLINT,
   CONSTRAINT "tblUser_UserID_key" UNIQUE("UserID"),
   CONSTRAINT "FK_PersonTitleID" FOREIGN KEY ("PersonTitleID")
     REFERENCES "public"."tblPersonTitle"("PersonTitleID")
     ON DELETE NO ACTION
     ON UPDATE NO ACTION
     NOT DEFERRABLE,
   CONSTRAINT "FK_SecretQuestionID" FOREIGN KEY ("SecretQuestionID")
     REFERENCES "public"."tblSecretQuestion"("SecretQuestionID")
     ON DELETE NO ACTION
     ON UPDATE NO ACTION
     NOT DEFERRABLE
) WITH OIDS;
D2ff155cd04fa175620d2f3495b11b08?d=identicon&s=25 Lorenzo Bolognini (lbolognini)
on 2006-01-19 14:37
Lorenzo Bolognini wrote:
> Hi all,
>
> I'm just starting out... the solution to this must be really trivial but
> can't figure out what's wrong. I'm using Webrick + Rails 1.0
>
> The error is:
>
> undefined method `useremail' error

Got it. It's a problem of case. Fixed now.

Tnx,
Lorenzo
This topic is locked and can not be replied to.