No method defined in controller

Hello all,

i am working on login module of application i have the method defined in Model and calling it from controller but the error says no method defined in controller below are model and controller code

class AuthenticationController < ApplicationController

def sign_in

@user = User.new

end

def login

username_or_email = params[:user][:username]

password = params[:user][:password]

if username_or_email.rindex(’@’)

email=username_or_email

user = User.authenticate_by_email(email, password)

else

username=username_or_email

user = User.authenticate_by_username(username, password)

end

if user

flash[:notice] = ‘Welcome.’

redirect_to :root

else

flash.now[:error] = ‘Unknown user. Please check your username and password.’

render :action => “sign_in”

end

end

end

For model

def self.authenticate_by_email(email, password)

user = find_by_email(email)

if user && user.password_hash == BCrypt::Engine.hash_secret(password, user.password_salt)

user

else

nil

end

end

Autentication by username

def self.authenticate_by_username(username, password)

user = find_by_username(username)

if user && user.password_hash == BCrypt::Engine.hash_secret(password, user.password_salt)

user

else

nil

end

end

Kindly help ASAP

Please copy/paste the full error message here, and tell us which line
of code it refers to.
We are not telepathic. At least I am not.

Colin