Rails LDAP login using net/ldap
问题 I am trying to get LDAP authentication to work under Rails. I have chosen net/ldap since it's a native Ruby LDAP library. I have tried all possible stuff, specially examples from http://net-ldap.rubyforge.org/classes/Net/LDAP.html but still unable to get it work. Any ideas? 回答1: The best solution I managed to reach is a Model with the following: require 'net/ldap' class User < ActiveRecord::Base def after_initialize @config = YAML.load(ERB.new(File.read("#{Rails.root}/config/ldap.yml"))