<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/resource_this_sorting_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -118,7 +118,8 @@ Not scaffolding. Resourcing. Creates extremely customizable resource controllers
     end
   end
 
-Nested resources like so:
+Nested Resources
+===========
 
   class CommentsController &lt; ActionController::Base
     resource_this :nested =&gt; [:posts]
@@ -132,8 +133,49 @@ This generates a very similar controller to the one above with adjusted redirect
     @post = Post.find(params[:post_id])
   end
   
+Sorting, etc
+===========
+
+  class CommentsController &lt; ActionController::Base
+    resource_this :finder_options =&gt; {:order =&gt; 'created_on'}
+  end
+  
+...or, for lazily evaluated sorting options:
+
+  class CommentsController &lt; ActionController::Base
+    resource_this :finder_options =&gt; Proc.new { finder_options }
+    
+  protected
+  
+    def finder_options
+      order = case params[:sort]
+        when 'date_reverse'          then 'created_on desc'
+        else 'created_on'
+      end
+      {:order =&gt; order, :limit =&gt; params[:limit] || 10 }
+    end
+    
+  end
+
+will_paginate
+===========
+
+will_paginate support is baked right in:
+
+  class CommentsController &lt; ActionController::Base
+    resource_this :will_paginate =&gt; true
+  end
+  
+This works with the :finder_options option as well
+  
+Opinionated Software
+===========
+  
 The separation of logic - DB operations in before_filters, rendering in the standard resource controller methods - makes this approach ridiculously easy to customize. Need to load an additional object for the :show action? Slap another before_filter on it. Need to change the path that the :update action redirects to? Override the :update action with your new rendering behavior.
 
+Generator
+===========
+
 A resource_this generator is included - does the same thing as the 'resource' generator but adds 'resource_this' to the generated controller.
 
 Questions? Comments? Flames? Patches?</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +0,0 @@
-* Document will_paginate support.
-* Add logical sorting support to the :index action.
\ No newline at end of file</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ module ResourceThis # :nodoc:
 
   module ClassMethods
     def resource_this(options = {})
-      options.assert_valid_keys(:class_name, :will_paginate, :sort_method, :nested, :path_prefix)
+      options.assert_valid_keys(:class_name, :will_paginate, :finder_options, :nested, :path_prefix)
 
       singular_name         = controller_name.singularize
       singular_name         = options[:class_name].downcase.singularize unless options[:class_name].nil?
@@ -16,6 +16,9 @@ module ResourceThis # :nodoc:
       list_url_string       = &quot;#{plural_name}_url&quot;
       finder_base           = class_name
       
+      class_inheritable_accessor :resource_this_finder_options
+      self.resource_this_finder_options = options[:finder_options] || {}
+      
       unless options[:nested].nil?
         nested              = options[:nested].to_s.singularize
         nested_class        = nested.camelize
@@ -81,13 +84,15 @@ module ResourceThis # :nodoc:
       if will_paginate_index
         module_eval &lt;&lt;-&quot;end_eval&quot;, __FILE__, __LINE__
           def load_#{plural_name}
-            @#{plural_name} = #{finder_base}.paginate(:page =&gt; params[:page])
+            finder_options = resource_this_finder_options.class == Proc ? resource_this_finder_options.call : resource_this_finder_options
+            @#{plural_name} = #{finder_base}.paginate(finder_options.merge(:page =&gt; params[:page]))
           end
         end_eval
       else
         module_eval &lt;&lt;-&quot;end_eval&quot;, __FILE__, __LINE__
           def load_#{plural_name}
-            @#{plural_name} = #{finder_base}.find(:all)
+            finder_options = resource_this_finder_options.class == Proc ? resource_this_finder_options.call : resource_this_finder_options
+            @#{plural_name} = #{finder_base}.find(:all, finder_options)
           end
         end_eval
       end</diff>
      <filename>lib/resource_this.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
 require 'action_controller/test_process'
-require 'active_record/fixtures'
+require 'test/unit'
 
 ActiveRecord::Base.establish_connection(:adapter =&gt; &quot;sqlite3&quot;, :dbfile =&gt; &quot;:memory:&quot;)
 
@@ -17,6 +17,12 @@ ActiveRecord::Schema.define(:version =&gt; 1) do
     t.column :created_at,   :datetime
     t.column :updated_at,   :datetime
   end
+  create_table :widgets do |t|
+    t.column :title,        :string
+    t.column :body,         :text
+    t.column :created_at,   :datetime
+    t.column :updated_at,   :datetime
+  end
 end
 
 class Post &lt; ActiveRecord::Base
@@ -33,10 +39,19 @@ class Comment &lt; ActiveRecord::Base
   validates_associated :post
 end
 
+class Widget &lt; ActiveRecord::Base
+  def validate
+  end
+end
+
 class PostsController &lt; ActionController::Base
   resource_this
 end
 
+class WidgetsController &lt; ActionController::Base
+  resource_this
+end
+
 module Admin; end
 
 class Admin::PostsController &lt; ActionController::Base</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>93a28c0993f6b13ea244800452b883f51dfcaf58</id>
    </parent>
  </parents>
  <author>
    <name>jnewland</name>
    <email>jnewland@9b6b69f6-dd27-0410-8144-a0f3c56a22ea</email>
  </author>
  <url>http://github.com/jnewland/resource_this/commit/456fa6eaf9925653336b1608bd6132e0f7d2d52c</url>
  <id>456fa6eaf9925653336b1608bd6132e0f7d2d52c</id>
  <committed-date>2007-10-15T07:33:33-07:00</committed-date>
  <authored-date>2007-10-15T07:33:33-07:00</authored-date>
  <message>sorting

git-svn-id: http://jnewland.com/svn/public/ruby/rails/plugins/resource_this@43 9b6b69f6-dd27-0410-8144-a0f3c56a22ea</message>
  <tree>ce8fbb7f9a80feb36aec6df89e79630eaee7cb4f</tree>
  <committer>
    <name>jnewland</name>
    <email>jnewland@9b6b69f6-dd27-0410-8144-a0f3c56a22ea</email>
  </committer>
</commit>
