title: ruby-ldap gem not work in rails3 app, but work in rails console
body: <p>I want to build a rails3 website authed with LDAP, so I chose ruby-ldap gem (not net/ldap) which we used in our old rails2 apps and works very well. </p>
  
  <p>But I keep on getting weird error in rails3 app, See the codes below: </p>
  
  <pre><code>require 'ldap'
  class WelcomeController &lt; ApplicationController
  
    def index  
      begin
        @test = LDAP::Conn.new('10.72.64.11', 389)
      rescue LDAP::Error
        p LDAP::Error
      end  
      render :text =&gt; "ok"
    end
  end 
  </code></pre>
  
  <p>welcome#index is my root route. Most time, the app crashes when going to LDAP::Conn.new('10.72.64.11', 389), even I tried to use "pry" to debug and track, throwing </p>
  
  <pre><code>[1]    24797 trace trap  rails s
  </code></pre>
  
  <p>and the WEBrick server will be terminated right that time. </p>
  
  <p>Sometimes it throws another type error when I use "pry" to step, 
  <code>#&lt;NameError: uninitialized constant WelcomeController::LDAP&gt;</code></p>
  
  <p>While try it in the console, everything goes well.</p>
  
  <pre><code>1.9.3-p194 :001 &gt; require 'ldap'
   =&gt; true 
  1.9.3-p194 :002 &gt; @test = LDAP::Conn.new('10.72.64.11', 389)
   =&gt; #&lt;LDAP::Conn:0x00000101289568&gt; 
  1.9.3-p194 :003 &gt; 
  </code></pre>
  
  <p>Can you guide me out of this crazy stuff? I am using ruby 1.9.3p194 and rails 3.2.8</p>