use net/ldap from my controller

I downloaded net-ldap gem and had no problem to use it from non-rail
applications.

But when I require 'net/ldap' from inside a rails controller. Rails
complains that it cannot load

LoadError (no such file to load -- net/ldap):
  app/controllers/supplier_controller.rb:1

I tried to add the following to my environment.rb:
Rails::Initializer.run do |config|
  config.gem :net-ldap
end

but now rails complains:

C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/application.rb:63:in
`inherited': You cannot have more than one Rails::Application
(RuntimeError)
        from
C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/deprecation.rb:7:in
`initialize'
        from
C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/deprecation.rb:7:in
`new'
        from
C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/deprecation.rb:7:in
`run'

Try adding it on your Gemfile.

Thanks!

1) Added gem 'net-ldap' to Gemfile
2) ran bundle install

and it works now.

Peter (Guo) Pei wrote in post #957055:

I downloaded net-ldap gem and had no problem to use it from non-rail
applications.

But when I require 'net/ldap' from inside a rails controller. Rails
complains that it cannot load

LoadError (no such file to load -- net/ldap):
  app/controllers/supplier_controller.rb:1

You shouldn't be calling it from inside your controllers anyway. That
sort of logic goes in a model.

Best,