Closed
Description
Not simplistic removal of s from end of name.
Good test is has_many :criteria
this should fix it:
module ActiveRecord
module Associations
class AssociationReflection
def initialize(owner_class, macro, name, options = {})
owner_class.reflect_on_all_associations << self
@owner_class = owner_class
@macro = macro
@options = options
@klass_name = options[:class_name] || (collection? && name.camelize.singularize) || name.camelize
@association_foreign_key = options[:foreign_key] || (macro == :belongs_to && "#{name}_id") || "#{@owner_class.name.underscore}_id"
@source = options[:source] || @klass_name.underscore if options[:through]
@attribute = name
end
end
end