<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,7 +3,7 @@ require 'forwardable'
 module DataMapper
   module Associations
     module OneToMany
-      OPTIONS = [ :class_name, :child_key, :parent_key, :min, :max ]
+      OPTIONS = [ :class_name, :child_key, :parent_key, :min, :max, :order ]
 
       private
 </diff>
      <filename>lib/data_mapper/associations/one_to_many.rb</filename>
    </modified>
    <modified>
      <diff>@@ -36,7 +36,8 @@ module DataMapper
 
       def get_children(parent)
         query = child_key.to_query(parent_key.get(parent))
-
+        query.merge!({:order =&gt; @child_order}) if @child_order
+        
         DataMapper.repository(parent.repository.name) do
           child_model.all(query)
         end
@@ -81,11 +82,16 @@ module DataMapper
         if parent_properties = options[:parent_key]
           raise ArgumentError, &quot;+parent_properties+ must be an Array or nil, but was #{parent_properties.class}&quot;, caller unless Array === parent_properties
         end
+        
+        if child_order = options[:order]
+          raise ArgumentError, &quot;+child_order+ must be an Array or nil, but was #{child_order.class}&quot;, caller unless Array === child_order
+        end
 
         @name              = name
         @repository_name   = repository_name
         @child_model_name  = child_model_name
         @child_properties  = child_properties   # may be nil
+        @child_order       = child_order        # may be nil
         @parent_model_name = parent_model_name
         @parent_properties = parent_properties  # may be nil
         @loader            = loader</diff>
      <filename>lib/data_mapper/associations/relationship.rb</filename>
    </modified>
    <modified>
      <diff>@@ -54,7 +54,7 @@ if HAS_SQLITE3
     property :name, String
 
     repository(:sqlite3) do
-      one_to_many :slices
+      one_to_many :slices, :order =&gt; [:id.desc]
     end
   end
 
@@ -355,15 +355,15 @@ if HAS_SQLITE3
         s.host_id.should be_nil
       end
 
-      it &quot;should load the associated instances&quot; do
+      it &quot;should load the associated instances, in the correct order&quot; do
         h = repository(:sqlite3) do
           Host.first(:id =&gt; 1)
         end
 
         h.slices.should_not be_nil
         h.slices.size.should == 2
-        h.slices.first.id.should == 1
-        h.slices.last.id.should == 2
+        h.slices.first.id.should == 2 # ordered by [:id.desc] 
+        h.slices.last.id.should == 1
 
         s0 = repository(:sqlite3) do
           Slice.first(:id =&gt; 0)</diff>
      <filename>spec/integration/association_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c40a8c4791060f22d32a42a14f25ee147e7ed68e</id>
    </parent>
  </parents>
  <author>
    <name>Sindre Aarsaether</name>
    <email>sindre@identu.no</email>
  </author>
  <url>http://github.com/sam/dm-core/commit/6160981583de998b75d7ae925c1864c77370e176</url>
  <id>6160981583de998b75d7ae925c1864c77370e176</id>
  <committed-date>2008-05-14T16:46:51-07:00</committed-date>
  <authored-date>2008-05-14T16:46:51-07:00</authored-date>
  <message>added support for ordering one_to_many-associations</message>
  <tree>69b93b1a517c3cc22861c79a8d9d423ded6bef92</tree>
  <committer>
    <name>Sindre Aarsaether</name>
    <email>sindre@identu.no</email>
  </committer>
</commit>
