Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8985301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:18:02+00:00 2026-06-15T21:18:02+00:00

I want to build a rails3 website authed with LDAP, so I chose ruby-ldap

  • 0

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.

But I keep on getting weird error in rails3 app, See the codes below:

require 'ldap'
class WelcomeController < ApplicationController

  def index  
    begin
      @test = LDAP::Conn.new('10.72.64.11', 389)
    rescue LDAP::Error
      p LDAP::Error
    end  
    render :text => "ok"
  end
end 

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

[1]    24797 trace trap  rails s

and the WEBrick server will be terminated right that time.

Sometimes it throws another type error when I use “pry” to step,
#<NameError: uninitialized constant WelcomeController::LDAP>

While try it in the console, everything goes well.

1.9.3-p194 :001 > require 'ldap'
 => true 
1.9.3-p194 :002 > @test = LDAP::Conn.new('10.72.64.11', 389)
 => #<LDAP::Conn:0x00000101289568> 
1.9.3-p194 :003 > 

Can you guide me out of this crazy stuff? I am using ruby 1.9.3p194 and rails 3.2.8

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:18:03+00:00Added an answer on June 15, 2026 at 9:18 pm

    A few months later, I kind of figure out what the problem is…

    The ruby-ldap gem has problem on running on the rails default server: Webrick.

    Try Pow or Passenger, it works perfect!

    After reading this page: http://www.ruby-forum.com/topic/62920

    I tried moving the require ‘ldap’ from the controller or model file, and into the very top line of my environment file (xxxlocal.rb)

    After I did that, I was able to run it ok in webrick also.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want build a photography app with effects . e.g. old images with brown
I want to build a website where people can create tests with questions and
I want to build an app that use in the backend Ruby on Rails.
I want to build a company to demonstrate and sell our products. It should
I want to build a hash that is used to store a directory. I
I want to build a simple website that can download a webpage www.example.com/index.html and
This is what I want to build in Ruby on Rails: <tr> <td>attribute0</td> <input
I want to build a rails request with 2 models. I think it's quite
I'm a newcomer to Rails. I want to build a simple form that determines
I want build a sketch pad app on iPhone, I assume that this type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.