lib/active_ldap/associations.rb in activeldap-1.0.0 vs lib/active_ldap/associations.rb in activeldap-1.0.1
- old
+ new
@@ -42,11 +42,11 @@
# :foreign_key => "gidNumber", # User#gidNumber
# :primary_key => "gidNumber" # Group#gidNumber
#
def belongs_to(association_id, options={})
validate_belongs_to_options(options)
- klass = options[:class] || Inflector.classify(association_id)
+ klass = options[:class] || association_id.to_s.classify
foreign_key = options[:foreign_key]
primary_key = options[:primary_key]
many = options[:many]
set_associated_class(association_id, klass)
@@ -94,11 +94,11 @@
# :foreign_key => "gidNumber" # Group#gidNumber
# has_many :members, :class_name => "User",
# :wrap => "memberUid" # Group#memberUid
def has_many(association_id, options = {})
validate_has_many_options(options)
- klass = options[:class] || Inflector.classify(association_id)
- foreign_key = options[:foreign_key] || association_id.to_s + "_id"
+ klass = options[:class] || association_id.to_s.classify
+ foreign_key = options[:foreign_key] || "#{association_id}_id"
primary_key = options[:primary_key]
set_associated_class(association_id, klass)
opts = {
:association_id => association_id,