<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,8 +1,8 @@
 ActionController::Base.class_eval do
-  def paginate_latests(sym, *map)
+  def paginate_latests(sym, map = {})
     model = sym.to_s.gsub(&quot;_&quot;, &quot; &quot;).singularize.split.each{ |word| word.capitalize! }.join('')
     page = params[:page] || 1
-    per_page = (map.first[:per_page] if map.size &gt; 0) || 10
-    Kernel.const_get(model).paginate(:page =&gt; page, :order =&gt; &quot;id DESC&quot;, :per_page =&gt; per_page)
+    map.merge!(:page =&gt; page, :order =&gt; &quot;id DESC&quot;) 
+    Kernel.const_get(model).paginate(map)
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/will_paginate_latests.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,22 +5,23 @@ class RailersController &lt; ActionController::Base
     @railers = paginate_latests(:railers)
   end
   def per_page
-    @railers = paginate_latests(:railers, :per_page =&gt; 20)
+    @railers = paginate_latests(:railers, :per_page =&gt; @@per_page)
+  end
+  def condition
+    @railers = paginate_latests(:railers, :condition =&gt; @@condition)
   end
 end
 
 describe RailersController do
   
-  before :each do
+  before :all do
     @result = 567
     @page = 1
-    @per_page = 10
   end
   
-  def expect
-    Railer.should_receive(:paginate).
-          with(:page =&gt; @page, :per_page =&gt; @per_page, :order =&gt; &quot;id DESC&quot;).
-          and_return(@result)
+  def expect(map = {})
+    map.merge!(:page =&gt; @page, :order =&gt; &quot;id DESC&quot;)
+    Railer.should_receive(:paginate).with(map).and_return(@result)
   end
 
   it &quot;should paginates latests railers by id&quot; do
@@ -31,10 +32,16 @@ describe RailersController do
   end
   
   it &quot;should paginate given a per_page&quot; do
-    @per_page = 20
-    expect
+    @@per_page = 20
+    expect(:per_page =&gt; @@per_page)
     get :per_page
     assigns[:railers].should eql(@result)
   end
 
+  it &quot;should paginate given a condition&quot; do
+    @@condition = &quot;1 = 2&quot;
+    expect(:condition =&gt; @@condition)
+    get :condition
+    assigns[:railers].should eql(@result)
+  end
 end</diff>
      <filename>spec/controller/will_paginate_latests_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bf6676ab1baf64680a22c7c8dd383d411c36fd78</id>
    </parent>
  </parents>
  <author>
    <name>Diego Carrion</name>
    <email>dcrec1@dcrec1.(none)</email>
  </author>
  <url>http://github.com/dcrec1/will_paginate_latests/commit/9cc42023d2e9c6a0268ffbb193412f774079f234</url>
  <id>9cc42023d2e9c6a0268ffbb193412f774079f234</id>
  <committed-date>2008-12-03T07:07:11-08:00</committed-date>
  <authored-date>2008-12-03T07:07:11-08:00</authored-date>
  <message>paginate_latests now accepts a condition</message>
  <tree>52933393013cff29c026aad6e333a8ebcea639ff</tree>
  <committer>
    <name>Diego Carrion</name>
    <email>dcrec1@dcrec1.(none)</email>
  </committer>
</commit>
