0

I'm working with NET-LDAP API using Ruby on Rails:

@ldap.search( :base => @treebase, :filter => @filter ) do |entry|
  entry.cn

When I get the entry.cn value it comes formatted as ["example"] How do I get this value without the characters [" "]?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303

1 Answers1

2

["example"] means that you've got an array with one string.

To get the first element of an array in Rails you can call:

["example"].first
the Tin Man
  • 158,662
  • 42
  • 215
  • 303