2011-06-16 61 views
2

下面指定的代碼在ruby(控制檯)irb中運行正常,但是當我將相同的代碼放入控制器時顯示「沒有連接到服務器」。有人可以指導什麼是錯的呢..謝謝。Ruby LDAP不能在Rails應用程序中工作,但在控制檯中工作正常

require "rubygems" 
require "net/ldap" 

ldap = Net::LDAP.new 
ldap.host = "host details" 
ldap.port = 389 
ldap.auth "company_name\\login","password" 

ldap.bind 

回答

2
use gem install 'net-ldap' 

require 'rubygems' 
require 'net-ldap' 

ldap = Net::LDAP.new 
ldap.host = "yourhost" 
ldap.port = port 
ldap.auth "your_username", "your_password" 
ldap.bind 
相關問題