rbp-book icon indicating copy to clipboard operation
rbp-book copied to clipboard

p137 - Extra parameter in method call?

Open mikbe opened this issue 13 years ago • 0 comments

On page 137 of Chapter 5 should the self#authenticate method be changed from this:

def self.authenticate(username, password) 
  user = new(username, password)
  user.authenticate(password)
rescue Net::LDAP::LdapError => e 
  ActiveRecord::Base.logger.debug "!!! LDAP Error: #{e.message} !!!" 
  false
end

To this since the initialize method only takes one parameter?

def self.authenticate(username, password) 
  user = new(username) # <= Remove the password parameter
  user.authenticate(password)
rescue Net::LDAP::LdapError => e 
  ActiveRecord::Base.logger.debug "!!! LDAP Error: #{e.message} !!!" 
  false
end

mikbe avatar Jun 14 '11 12:06 mikbe