diff --git a/lib/devise_ldap_authenticatable/ldap/connection.rb b/lib/devise_ldap_authenticatable/ldap/connection.rb index faefa574cc..072545a4fd 100644 --- a/lib/devise_ldap_authenticatable/ldap/connection.rb +++ b/lib/devise_ldap_authenticatable/ldap/connection.rb @@ -7,7 +7,12 @@ def initialize(params = {}) if ::Devise.ldap_config.is_a?(Proc) ldap_config = ::Devise.ldap_config.call else - ldap_config = YAML.load(ERB.new(File.read(::Devise.ldap_config || "#{Rails.root}/config/ldap.yml")).result)[Rails.env] + source = ERB.new(File.read(::Devise.ldap_config || "#{Rails.root}/config/ldap.yml")).result + begin + ldap_config = YAML.load(source, aliases: true)[Rails.env] + rescue ArgumentError + ldap_config = YAML.load(source)[Rails.env] + end end ldap_options = params