Lorenzo Bolognini
2006-Jan-19 01:38 UTC
[Rails] [Newbie] undefined method `useremail'' error
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;
Lorenzo Bolognini
2006-Jan-19 13:01 UTC
[Rails] Re: [Newbie] undefined method `useremail'' error
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'' errorGot it. It''s a problem of case. Fixed now. Tnx, Lorenzo -- Posted via http://www.ruby-forum.com/.