Hi Everyone,
Am new to this Ruby on Rails forum & also developing
applications in ROR. I have been stuck up for quite a long time in
''Authentication'' page. I have developed a basic login
authentication
page - which gets user id and password and validates it. No encryption
in password.
Database name : cms
Table name : users
Authentication Code :
class CmsController < ApplicationController
def index
end
def world
render :text => "hello world! The time is #{Time.now}."
end
# Login Authentication
def authenticate
user = User.find_by_email_and_password params[:loginTxt],
params[:pwdTxt]
if user
session[:user_id] = user.id
# ToDo: Store user details in a hash in the session state
session[:first_name] = user.first_name
session[:last_name] = user.last_name
redirect_to(:controller => ''world'')
else
flash[:error] = ''Log In Failed''
redirect_to :action => ''index''
return
end
end
end
I get this error : "NameError in CmsController#authenticate"
"uninitialized constant User"
Can anyone help me solve this problem?? Thanks in advance....
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---