Changeset [2ffa59f0963c3a33be72ae2796f0d5d286c7d863] by snusnu

January 13th, 2011 @ 09:15 PM

Implement true set semantics for DescendantSet

Backing the DescendantSet with a SubjectSet makes
sure that when new a new constant with the same
name gets added (as is the case after code reloads
in dm-rails), the old constant with the same name
gets updated instead of the new one being appended.

To make this work, a change to the way we construct
anonymous join models was needed. Previously, we
were first creating a new model class using, and then we assigned that class to the
desired constant name. The problem with this is
that the anonymous model got added to the
DescendantSet at a time where it's desired name
hasn't yet been set. This left us with an entry in
the DescendantSet that wasn't identified by the
correct name.

This patch changes the method signature of the
semipublic method:

module DataMapper

# OLD:
# The storage_name parameter has been
# deprecated since Jan 2, 2009
# see: = nil, &block)

# NEW: = nil, namespace = nil, &block)


The new signature expects "name" to be a String
and "namespace" to be a constant that will hold
the newly created model.

[#1453 state:resolved]

Committed by snusnu

  • M lib/dm-core/associations/many_to_many.rb
  • M lib/dm-core/model.rb
  • M lib/dm-core/spec/lib/spec_helper.rb
  • M lib/dm-core/support/descendant_set.rb
  • M spec/public/property/text_spec.rb
  • M spec/semipublic/query_spec.rb
New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »