<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,3 +2,4 @@ log
 tmp
 debug.log
 local/*.rb
+pkg</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,7 @@
+== 1.0.2 2008-06-07
+
+* fix for has many through when through association has composite keys
+
 == 1.0.1 2008-06-06
 
 * Oracle fixes</diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -57,7 +57,8 @@ module CompositePrimaryKeys
               #add conditions from reflection!
               through_records.first.class.preload_associations(through_records, source, reflection.options)
               through_records.each do |through_record|
-                add_preloaded_records_to_collection(id_to_record_map[through_record[through_primary_key].to_s], reflection.name, through_record.send(source))
+                key = through_primary_key.to_s.split(CompositePrimaryKeys::ID_SEP).map{|k| through_record.send(k)}.join(CompositePrimaryKeys::ID_SEP)
+                add_preloaded_records_to_collection(id_to_record_map[key], reflection.name, through_record.send(source))
               end
             end
           else </diff>
      <filename>lib/composite_primary_keys/association_preload.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ module CompositePrimaryKeys
   module VERSION #:nodoc:
     MAJOR = 1
     MINOR = 0
-    TINY  = 1
+    TINY  = 2
     STRING = [MAJOR, MINOR, TINY].join('.')
   end
 end</diff>
      <filename>lib/composite_primary_keys/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -135,4 +135,27 @@ create table restaurants_suburbs (
 	store_id int(11) not null,
 	city_id int(11) not null,
 	suburb_id int(11) not null
+) TYPE=InnoDB;
+
+create table dorms (
+	id int(11) not null auto_increment,
+	primary key(id)
+) TYPE=InnoDB;
+
+create table rooms (
+	dorm_id int(11) not null,
+	room_id int(11) not null,
+	primary key (dorm_id, room_id)
+) TYPE=InnoDB;
+
+create table room_attributes (
+	id int(11) not null auto_increment,
+	name varchar(50),
+	primary key(id)
+) TYPE=InnoDB;
+
+create table room_attribute_assignments (
+	dorm_id int(11) not null,
+	room_id int(11) not null,
+	room_attribute_id integer not null
 ) TYPE=InnoDB;
\ No newline at end of file</diff>
      <filename>test/fixtures/db_definitions/mysql.sql</filename>
    </modified>
    <modified>
      <diff>@@ -124,4 +124,25 @@ create table restaurants_suburbs (
 	store_id integer not null,
 	city_id integer not null,
 	suburb_id integer not null
-);
\ No newline at end of file
+);
+
+create table dorms (
+	id integer not null primary key autoincrement
+);
+
+create table rooms (
+	dorm_id integer not null,
+	room_id integer not null,
+	primary key (dorm_id, room_id)
+);
+
+create table room_attributes (
+	id integer not null primary key autoincrement,
+	name varchar(50)
+);
+
+create table room_attribute_assignments (
+	dorm_id integer not null,
+	room_id integer not null,
+	room_attribute_id integer not null
+);</diff>
      <filename>test/fixtures/db_definitions/sqlite.sql</filename>
    </modified>
    <modified>
      <diff>@@ -5,9 +5,14 @@ require 'fixtures/product_tariff'
 require 'fixtures/suburb'
 require 'fixtures/street'
 require 'fixtures/restaurant'
+require 'fixtures/dorm'
+require 'fixtures/room'
+require 'fixtures/room_attribute'
+require 'fixtures/room_attribute_assignment'
 
 class TestAssociations &lt; Test::Unit::TestCase
-  fixtures :products, :tariffs, :product_tariffs, :suburbs, :streets, :restaurants, :restaurants_suburbs
+  fixtures :products, :tariffs, :product_tariffs, :suburbs, :streets, :restaurants, :restaurants_suburbs,
+           :dorms, :rooms, :room_attributes, :room_attribute_assignments
   
   def test_quoted_table_columns
     assert_equal &quot;product_tariffs.product_id,product_tariffs.tariff_id,product_tariffs.tariff_start_date&quot;, 
@@ -94,6 +99,13 @@ class TestAssociations &lt; Test::Unit::TestCase
     assert_equal 3, @products.inject(0) {|sum, product| sum + product.instance_variable_get('@tariffs').length},
       &quot;Incorrect number of tariffs returned&quot;
   end
+  
+  def test_has_many_through_when_through_association_is_composite
+    dorm = Dorm.find(:first)
+    assert_equal 1, dorm.rooms.length
+    assert_equal 1, dorm.rooms.first.room_attributes.length
+    assert_equal 'keg', dorm.rooms.first.room_attributes.first.name
+  end
 
   def test_associations_with_conditions
     @suburb = Suburb.find([2, 1])</diff>
      <filename>test/test_associations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -33,7 +33,7 @@
     &lt;h1&gt;Composite Primary Keys&lt;/h1&gt;
     &lt;div id=&quot;version&quot; class=&quot;clickable&quot; onclick='document.location = &quot;http://rubyforge.org/projects/compositekeys&quot;; return false'&gt;
       Get Version
-      &lt;a href=&quot;http://rubyforge.org/projects/compositekeys&quot; class=&quot;numbers&quot;&gt;0.9.92&lt;/a&gt;
+      &lt;a href=&quot;http://rubyforge.org/projects/compositekeys&quot; class=&quot;numbers&quot;&gt;1.0.2&lt;/a&gt;
     &lt;/div&gt;
     &lt;h1&gt;&amp;#x2192; Ruby on Rails&lt;/h1&gt;
 
@@ -296,7 +296,7 @@ other stories and things.&lt;/p&gt;
 
 	&lt;p&gt;Comments are welcome. Send an email to &lt;a href=&quot;mailto:drnicwilliams@gmail.com&quot;&gt;Dr Nic Williams&lt;/a&gt;.&lt;/p&gt;
     &lt;p class=&quot;coda&quot;&gt;
-      &lt;a href=&quot;mailto:drnicwilliams@gmail.com&quot;&gt;Dr Nic&lt;/a&gt;, 5th March 2008&lt;br&gt;
+      &lt;a href=&quot;mailto:drnicwilliams@gmail.com&quot;&gt;Dr Nic&lt;/a&gt;, 6th June 2008&lt;br&gt;
       Theme extended from &lt;a href=&quot;http://rb2js.rubyforge.org/&quot;&gt;Paul Battley&lt;/a&gt;
     &lt;/p&gt;
 &lt;/div&gt;</diff>
      <filename>website/index.html</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,3 @@
 // Announcement JS file
-var version = &quot;0.9.92&quot;;
+var version = &quot;1.0.2&quot;;
 MagicAnnouncement.show('compositekeys', version);</diff>
      <filename>website/version-raw.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
 // Version JS file
-var version = &quot;0.9.92&quot;;
+var version = &quot;1.0.2&quot;;
 
 document.write(&quot; - &quot; + version);</diff>
      <filename>website/version.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>01468d2faad7de209c3b35cb1cd60893b003bd35</id>
    </parent>
  </parents>
  <author>
    <name>Darrin Holst</name>
    <email>dholst@dholst-air.local</email>
  </author>
  <url>http://github.com/drnic/composite_primary_keys/commit/2ba0b2cd90237678fad87c12bf336122d328aa8f</url>
  <id>2ba0b2cd90237678fad87c12bf336122d328aa8f</id>
  <committed-date>2008-06-07T10:27:35-07:00</committed-date>
  <authored-date>2008-06-07T10:27:35-07:00</authored-date>
  <message>fix has many through when through association has composite keys</message>
  <tree>b855bcee23a709269398be0ec5997643889e9896</tree>
  <committer>
    <name>Darrin Holst</name>
    <email>dholst@dholst-air.local</email>
  </committer>
</commit>
