<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,16 +3,19 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
 
 require 'set'
 require 'fileutils'
-begin
-  require 'extlib' 
-rescue LoadError =&gt; e
-  raise e, &quot;Extlib is missing. See http://github.com/sam/extlib/&quot;
-end
-begin
-  require 'tokyocabinet-wrapper' 
-rescue LoadError =&gt; e
-  raise e, &quot;Tokyocabinet wrapper is missing. See http://github.com/oleganza/tokyocabinet-wrapper/&quot;
+
+def git_require(name, url)
+  begin
+    require name
+  rescue LoadError =&gt; e
+    raise e, &quot;#{name} is missing. See #{url}&quot;
+  end  
 end
+
+git_require 'extlib',               'http://github.com/sam/extlib/'
+git_require 'tokyocabinet-wrapper', 'http://github.com/oleganza/tokyocabinet-wrapper/'
+git_require 'declarations',         'http://github.com/oleganza/declarations/'
+
 require 'strokedb/version'
 require 'strokedb/constants'
 require 'strokedb/util'</diff>
      <filename>lib/strokedb.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 module StrokeDB
   module Associations
     module Base
-      include StrokeDB::Declarations
+      include Declarations
       
       def register_association(association)
         local_declarations(:associations, []) do |list|
@@ -17,6 +17,11 @@ module StrokeDB
           end
         end
       end      
+
+      # Returns association object for a given slotname.
+      def association(slotname)
+        associations.detect{|a| a.slotname = slotname }
+      end
       
     end # Base
   end # Associations</diff>
      <filename>lib/strokedb/associations/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,7 @@ module StrokeDB
       end
     
       class Association
-        attr_accessor :slotname
+        attr_accessor :slotname, :options
       
         def initialize(options)
           @options = OptionsHash(options)
@@ -27,17 +27,30 @@ module StrokeDB
       
         def setup(mod)
           slotname = @slotname
+          mod.extend StrokeObjects::SlotHooks
           mod.send(:define_method, slotname) do
             self[slotname]
           end
           mod.send(:define_method, slotname.to_s + &quot;=&quot;) do |value|
             self[slotname] = value
           end
+          mod.slot_hook(slotname, AssociationSlotHook)
+        end
         
-          # self.on_get_slot(slotname, )
-          # on slot access -&gt; create proxy
+        module AssociationSlotHook
+          def get(doc, slotname)
+            ivar = &quot;@#{slotname}&quot;
+            proxy = doc.instance_variable_get(ivar)
+            proxy and return proxy
+            assoc = doc.class.association(slotname)
+            proxy = CollectionProxy.new(assoc)
+            doc.instance_variable_set(ivar, proxy)
+          end
+          def set(doc, slotname, value)
+            
+          end
         end
-      
+        
         class CollectionProxy
           def initialize(document)
           </diff>
      <filename>lib/strokedb/associations/has_many.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 module StrokeDB
   module NSURL
-    include StrokeDB::Declarations
+    include Declarations
     
     NO_NSURL = Object.new.freeze
     </diff>
      <filename>lib/strokedb/document/nsurl.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 module StrokeDB
   module StrokeObjects
     module SlotHooks
-      include StrokeDB::Declarations
+      include Declarations
       # Sets inheritable get/set hooks on a slot.
       #
       # Example:</diff>
      <filename>lib/strokedb/stroke_objects/slot_hooks.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,10 @@
 require 'time'
-require 'strokedb/util/absolutely_all_ancestors'
 require 'strokedb/util/options_hash'
 require 'strokedb/util/uuid'
 require 'strokedb/util/class_factory'
 require 'strokedb/util/require_one_of'
 require 'strokedb/util/verify'
 require 'strokedb/util/pluggable_module'
-require 'strokedb/util/declarations'
 require 'strokedb/util/lazy_mapping_array'
 require 'strokedb/util/lazy_mapping_hash'
 </diff>
      <filename>lib/strokedb/util.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 module StrokeDB
   module Validations
     module Base
-      include StrokeDB::Declarations
+      include Declarations
       
       def register_validation(validation)
         local_declarations(:validations, []) do |list|</diff>
      <filename>lib/strokedb/validations/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1,16 @@
 require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
+
+describe &quot;has_many :as&quot; do
+  
+  before(:each) do
+    @person_mod = Module.new do
+      extend Associations::HasMany
+      has_many :owned_accounts, :as =&gt; :owner, :kind_of =&gt; []
+    end
+  end
+  
+  it &quot;should description&quot; do
+    
+  end
+  
+end</diff>
      <filename>spec/lib/associations/has_many_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/strokedb/util/absolutely_all_ancestors.rb</filename>
    </removed>
    <removed>
      <filename>lib/strokedb/util/declarations.rb</filename>
    </removed>
    <removed>
      <filename>spec/lib/util/absolutely_all_ancestors_spec.rb</filename>
    </removed>
    <removed>
      <filename>spec/lib/util/declarations_spec.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>2fe29139ac7cb4221ffa1bb18fb57bc5eb7fcb8c</id>
    </parent>
  </parents>
  <author>
    <name>Oleg Andreev</name>
    <email>oleganza@gmail.com</email>
  </author>
  <url>http://github.com/oleganza/strokedb-core/commit/f1feb063b66f5b48e7ae2697a3b598592fc37708</url>
  <id>f1feb063b66f5b48e7ae2697a3b598592fc37708</id>
  <committed-date>2008-09-06T11:34:07-07:00</committed-date>
  <authored-date>2008-09-06T11:34:07-07:00</authored-date>
  <message>extracted declarations, fixed has_many</message>
  <tree>2a822f6f394da197c3992cbc0c7713c03d4892c1</tree>
  <committer>
    <name>Oleg Andreev</name>
    <email>oleganza@gmail.com</email>
  </committer>
</commit>
