TypeError in SessionsController#create

hej mam taki blad i nie wiem jak sobie z nim poradzic podczas logowania do aplikacji mam taki blad Cannot visit Integer
app/models/user.rb:36:in `authenticate’

require ‘digest’
class User < ActiveRecord::Base
attr_accessor :password
attr_accessible :email_id, :first_name, :last_name, :user_type_id, :password, :password_confirmation

#validations for the attributes of this entity.
validates :password, :presence => true, :confirmation => true, :length => {:within => 6…12}, :on => :create
validates :email_id, :presence => true, :format => {:with => SessionsHelper::EMAIL_REGEX}
validates :first_name, :presence => true
validates :last_name, :presence => true

#establishing one-to-one relation with user_type (A user can be of only one role)
belongs_to :user_type, :foreign_key => :user_type_id

#before save filter to encrypt password.
before_save :encrypt_password

#User can treat many patients. similarly, patients can get treatment from many Users so many to many relation between Users and Patients

is connected through intersection table user_patients.

has_many :user_patients
has_many :patients, :through => :user_patients

def has_password?(submitted_password)
encrypted_password == encrypt(submitted_password)
end

#Utility method to authenticate user.
def self.authenticate_with_salt(user_id)
return nil if user_id == nil
user = User.find(user_id[0])
(user && user.salt == user_id[1]) ? user : nil
end

def self.authenticate(email, pwd)
user = User.find_by_email_id(email)
if(user && user.has_password?(pwd))
return user
else
return nil
end
end

private
#private method to encrypt password using SHA2 Digest.
def encrypt_password
if(password.blank?)
return
else
self.salt = make_salt(password) unless has_password?(password)
self.encrypted_password = encrypt(password)
end
end

def encrypt(pwd)
secure_hash("#{salt}#{pwd}")
end

def secure_hash(str)
Digest::SHA2.hexdigest(str)
end

def make_salt(str)
secure_hash “#{Time.now.utc}#{str}”
end
end

app/controllers/sessions_controller.rb:12:in `create’

#Session management controller for the application.

class SessionsController < ApplicationController

#Action to render index page of the application.
def login
@page_name = SessionsHelper::LOGIN;
end

#Action to create session for the user if authentication succeeds.
def create
user = User.authenticate(params[:session][:email_id], params[:session][:password])
if user
reset_session
sign_in(user)
redirect_to user
else
render ‘login’
end
end

#Action to destroy session on user logout.
def destroy
sign_out
redirect_to login_path
end
end