<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -40,148 +40,3 @@ module StrokeDB
 end
 
 
-
-
-
-
-
-
-
-##########################################################
-----------------------------------------------------------
-
-
-module StrokeDB
-
-  module Associations
-    
-    AssociationViewImplementation = Proc.new do |view|
-      def view.map(uuid, doc)
-        reference_slotname = self[:reference_slotname]
-        through = self[:through]
-        expected_meta = self[:expected_meta]
-        expected_nsurl = self[:expected_nsurl]
-        conditions = self[:conditions]
-        sort_by = self[:sort_by]
-
-        if doc.meta.name == expected_meta &amp;&amp; doc.meta.nsurl == expected_nsurl
-          if (reference_slotname_value = doc[reference_slotname]) &amp;&amp;
-             (conditions.nil? ||
-              (conditions &amp;&amp;
-               (conditions.keys.select {|k| doc[k] == conditions[k]}.size == conditions.size)))
-            begin
-              key = [reference_slotname_value, doc]
-              key = [key[0],doc.send(sort_by),key[1]] if sort_by
-              through.each {|t| doc = doc.send(t) }
-            rescue SlotNotFoundError
-              return nil unless doc
-            else
-              [ 
-                [
-                  key,
-                  doc
-                ]
-              ]
-            end
-        end
-      end
-      end
-    end
-
-    module HasManyAssociation
-      attr_reader :association_owner, :association_slotname
-      def new(slots={})
-        association_meta.constantize.new(association_owner.store, slots.merge({association_reference_slotname =&gt; association_owner}))
-      end
-      alias :build :new
-
-      def create!(slots={})
-        new(slots).save!
-      end
-      
-      def &lt;&lt;(doc)
-        doc.update_slots! association_reference_slotname =&gt; association_owner
-        self
-      end
-      
-      private 
-
-      def association_reference_slotname
-        association_owner.meta[&quot;has_many_#{association_slotname}&quot;][:reference_slotname]
-      end
-
-      def association_meta
-        association_owner.meta[&quot;has_many_#{association_slotname}&quot;][:expected_meta]
-      end
-
-    end
-
-    def has_many(slotname, opts={}, &amp;block)
-      opts = opts.stringify_keys
-
-      reference_slotname = opts['foreign_reference']
-      through = opts['through'] || []
-      through = [through] unless through.is_a?(Array)
-      meta = (through.shift || slotname).to_s.singularize.camelize
-      nsurl = opts['nsurl'] || (name.modulize.empty? ? Module.nsurl : meta.modulize.constantize.nsurl)
-      extend_with = opts['extend'] || block
-      conditions = opts['conditions']
-      sort_by = opts['sort_by']
-      reverse = opts['reverse'] || false
-      
-      @meta_initialization_procs &lt;&lt; Proc.new do
-        case extend_with
-        when Proc
-          extend_with_proc = extend_with
-          extend_with = &quot;HasMany#{slotname.to_s.camelize}&quot;
-          const_set(extend_with, Module.new(&amp;extend_with_proc))
-          extend_with = &quot;#{self.name}::HasMany#{slotname.to_s.camelize}&quot;
-        when Module
-          extend_with = extend_with.name
-        when NilClass
-        else
-          raise &quot;has_many extension should be either Module or Proc&quot;
-        end
-        reference_slotname = reference_slotname || name.demodulize.tableize.singularize
-        
-        # TODO: remove the below commented out code, it seems that we do not need it anymore
-        # (but I am not sure, so that's why I've left it here)
-        # if name.index('::') # we're in namespaced meta
-        #   _t = name.split('::')
-        #   _t.pop
-        #   _t &lt;&lt; meta
-        #   meta = _t.join('::') 
-        # end
-        
-        view = View.define!(&quot;#{name.modulize.empty? ? Module.nsurl : name.modulize.constantize.nsurl}##{name.demodulize.tableize.singularize}_has_many_#{slotname}&quot;,
-                            { :reference_slotname =&gt; reference_slotname, :through =&gt; through, :expected_meta =&gt; meta, :expected_nsurl =&gt; nsurl, :extend_with =&gt; extend_with, 
-                              :conditions =&gt; conditions, :sort_by =&gt; sort_by, :reverse =&gt; reverse }, &amp;AssociationViewImplementation)
-        
-        @args.last.reverse_merge!({&quot;has_many_#{slotname}&quot; =&gt; view})
-        define_method(slotname) do 
-          _has_many_association(slotname)
-        end
-      end      
-    end 
-
-  private 
-
-    def initialize_associations
-      define_method(:_has_many_association) do |slotname|
-        slot_has_many = meta[&quot;has_many_#{slotname}&quot;]
-        result = LazyArray.new.load_with do |lazy_array|
-          slot_has_many.find(:key =&gt; self, :reverse =&gt; slot_has_many[:reverse])
-        end
-        if extend_with = slot_has_many[:extend_with] 
-          result.extend(extend_with.constantize) 
-        end
-        result.instance_variable_set(:@association_owner, self)
-        result.instance_variable_set(:@association_slotname, slotname)
-        result.extend(HasManyAssociation)
-        result
-      end
-    end
-  end
-end  
-
-</diff>
      <filename>lib/strokedb/document/index_slots.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>aa68457b31df9ffda318b2f6d0512ba775f52559</id>
    </parent>
  </parents>
  <author>
    <name>Yurii Rashkovskii</name>
    <email>yrashk@idbns.com</email>
  </author>
  <url>http://github.com/yrashk/strokedb/commit/c4427188a18e99d3af939c4c3d5eca687d3cf787</url>
  <id>c4427188a18e99d3af939c4c3d5eca687d3cf787</id>
  <committed-date>2008-05-22T16:53:33-07:00</committed-date>
  <authored-date>2008-05-22T16:53:33-07:00</authored-date>
  <message>Some garbage has been removed from index_slots.rb</message>
  <tree>b8e3d36cc78a831155b289b08c59530312e6367a</tree>
  <committer>
    <name>Yurii Rashkovskii</name>
    <email>yrashk@idbns.com</email>
  </committer>
</commit>
