I'm running rails 3.0.9 with activerecord 3.0.9 and have three database
connections in my rails application - LDAP connection, Oracle and Postgres
with PostGIS. I have installed gems GeoRuby v 1.3.4, spatial_adapter v
1.3.1, activerecord-oracle_enhanced-adapter v 1.4.0, ruby-ldap v 0.9.12 ,
pg v 0.14.0.
With both gems the spatial_adapter seem to work well which also is the case
for the Oracle connection. Problem is if I run spatial_adapter together
with ruby-ldap. The spatial adapter works but when I try to log in with
LDAP it fails. The perror-command reports the success of bind towards LDAP,
but hangs during search.
users = []
unless login.blank?
filter = "(&(objectClass=#{user_object_class})" +
"(#{user_login_attribute}=#{login}))"
Comp::Directory::LdapServer.as_anonymous do | conn |
puts conn.perror("bind")
conn.search(userbase, LDAP::LDAP_SCOPE_SUBTREE, filter) do |e|
users << LdapUser.new(e.to_hash)
end
puts conn.perror("search")
end
end
Rails reports error "failed to allocate memory" but running free -m -s1 in
another window does not indicate memory loss.
Running rails console with the following code works successfully:
conn = LDAP::Conn.new('ldap.comp.org', 389)
conn.bind('uid=3,cn=users,dc=com,dc=org', password)
conn.perror("bind")
res = conn.search("cn=systems,dc=comp,dc=org", LDAP::LDAP_SCOPE_SUBTREE,
"(&(objectClass=groupOfUniqueNames)(uniqueMember=uid=3,cn=users,dc=comp,dc=org))",['cn','description'])
conn.perror("search")
conn.unbind
The database.yml file
postgres_development:
adapter: postgresql
host: host1
database: db1
username: user1
password: password1
development:
adapter: oracle_enhanced
database: db2
username: user2
password: password2
timeout: 5000
encoding: utf8
An example of a postgres model:
class PgLocation < ActiveRecord::Base
establish_connection "postgres_"{RAILS_ENV}"
end
If I block the spatial_adapter in the Gemfile everything works well. I
welcome any ideas.
Thanks!
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/OU5a0D00uroJ.
For more options, visit https://groups.google.com/groups/opt_out.