Login authenticate?

Jamal Soueidan
Fri, 02 Mar 2007 12:23:19 -0000

Hello there,

I''m trying to do the login section for my small web application, but it
doesn''t seem to work like I want.

Here is the Controller:

  if request.post?
    @user = User.authenticate(params[:user][:email],
params[:user][:password])
    if @user
      redirect_to :action => ''my_account''
    end
  end

This is how the model authenticate look like.

  def self.authenticate(email, password)
    @user = User.find(  :first,
              :conditions => ["email = ? and password = ?", email,
password],
              :limit => 1);
    return false if @user.nil?
    return true if @user
  end


But whenever I try to login I get a error

undefined method `email'' for false:FalseClass

I don''t know what this one means? could anyone help me and Thanks for
Your help.

--
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
-~----------~----~----~----~------~----~------~--~---