<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -33,7 +33,7 @@ method.
 To display the pagination, use the paginate helper.
 	
 	# general usage
-	# path = String
+	# path = String/Proc
 	# options = Hash
 	&lt;%= paginate @users, path, options %&gt;
 	&lt;%= paginate @users, options={} %&gt;
@@ -48,6 +48,7 @@ To display the pagination, use the paginate helper.
 	&lt;%= paginate @users, users_path, :show_page =&gt; true %&gt;
 	&lt;%= paginate @users, users_path, :show_disabled =&gt; false %&gt;
 	&lt;%= paginate @users, :url =&gt; users_path %&gt;
+	&lt;%= paginate @users, :url =&gt; proc {|page| users_path(page) }%&gt;
 
 You can set properties globally.
 </diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,12 @@
 class Paginate
   @@settings = {
-    :next_label =&gt; 'Next page',
-    :previous_label =&gt; 'Previous page',
+    :next_label =&gt; &quot;Next page&quot;,
+    :previous_label =&gt; &quot;Previous page&quot;,
     :param_name =&gt; :page,
     :show_disabled =&gt; true,
     :show_page =&gt; true, 
     :limit =&gt; 10,
-    :format =&gt; 'Page %d'
+    :format =&gt; &quot;Page %d&quot;
   }
   
   def self.settings=(options)
@@ -106,15 +106,19 @@ module ApplicationHelper
     options[:page] ||= params[options[:param_name]]
     
     url = options.delete(:url)
-    url ||= request.request_uri
     
-    re = Regexp.new(&quot;([&amp;?])#{Regexp.escape(options[:param_name].to_s)}=[0-9]+&quot;)
-    url.gsub!(re, &quot;\\1&quot;)
-    url.gsub!(/\?$/, &quot;&quot;)
-    url.gsub!(/\?&amp;/, &quot;?&quot;)
-    url = URI.parse(url).to_s
+    unless url.kind_of?(Proc)
+      url ||= request.request_uri
+    
+      re = Regexp.new(&quot;([&amp;?])#{Regexp.escape(options[:param_name].to_s)}=[0-9]+&quot;)
+      url.gsub!(re, &quot;\\1&quot;)
+      url.gsub!(/\?$/, &quot;&quot;)
+      url.gsub!(/\?&amp;/, &quot;?&quot;)
+      url = URI.parse(url).to_s
+      
+      connector = (url =~ /\?/) ? &quot;&amp;amp;&quot; : &quot;?&quot;
+    end
     
-    connector = (url =~ /\?/) ? '&amp;amp;' : '?'
     current_page = Paginate.page(options)
     
     returning &quot;&quot; do |contents|
@@ -123,20 +127,30 @@ module ApplicationHelper
       page = &quot;&quot;
       
       if current_page &gt; 1
-        previous_url = url 
-        previous_url += connector + (current_page - 1).to_s.to_query(options[:param_name]) if current_page &gt; 2
-        link = content_tag(:a, options[:previous_label], :class =&gt; 'previous', :href =&gt; previous_url)
-        previous_item &lt;&lt; content_tag(:li, link, :class =&gt; 'previous')
+        if url.kind_of?(Proc)
+          previous_url = url.call(current_page - 1)
+        else
+          previous_url = url
+          previous_url += connector + (current_page - 1).to_s.to_query(options[:param_name]) if current_page &gt; 2
+        end
+        
+        link = content_tag(:a, options[:previous_label], :class =&gt; &quot;previous&quot;, :href =&gt; previous_url)
+        previous_item &lt;&lt; content_tag(:li, link, :class =&gt; &quot;previous&quot;)
       elsif options[:show_disabled]
-        previous_item &lt;&lt; content_tag(:li, content_tag(:span, options[:previous_label]), :class =&gt; 'previous disabled')
+        previous_item &lt;&lt; content_tag(:li, content_tag(:span, options[:previous_label]), :class =&gt; &quot;previous disabled&quot;)
       end
       
       if collection.length &gt; Paginate.limit(options)
-        next_url = url + connector + (current_page + 1).to_s.to_query(options[:param_name])
-        link = content_tag(:a, options[:next_label], :class =&gt; 'next', :href =&gt; next_url)
-        next_item &lt;&lt; content_tag(:li, link, :class =&gt; 'next')
+        if url.kind_of?(Proc)
+          next_url = url.call(current_page + 1)
+        else
+          next_url = url + connector + (current_page + 1).to_s.to_query(options[:param_name])
+        end
+        
+        link = content_tag(:a, options[:next_label], :class =&gt; &quot;next&quot;, :href =&gt; next_url)
+        next_item &lt;&lt; content_tag(:li, link, :class =&gt; &quot;next&quot;)
       elsif options[:show_disabled]
-        next_item &lt;&lt; content_tag(:li, content_tag(:span, options[:next_label]), :class =&gt; 'next disabled')
+        next_item &lt;&lt; content_tag(:li, content_tag(:span, options[:next_label]), :class =&gt; &quot;next disabled&quot;)
       end
       
       if options[:show_page]
@@ -144,7 +158,7 @@ module ApplicationHelper
       end
       
       if options[:disabled] || !previous_item.blank? || !next_item.blank?
-        contents &lt;&lt; content_tag(:ul, previous_item + page + next_item, :class =&gt; 'paginate')
+        contents &lt;&lt; content_tag(:ul, previous_item + page + next_item, :class =&gt; &quot;paginate&quot;)
       end
     end
   end</diff>
      <filename>lib/has_paginate.rb</filename>
    </modified>
    <modified>
      <diff>@@ -80,6 +80,12 @@ describe &quot;has_paginate&quot; do
       @helper.paginate(@things, :param_name =&gt; :p).should have_tag(&quot;a.next[href=/requested/path?p=2]&quot;, &quot;Next page&quot;)
     end
     
+    it &quot;should call proc as url parameter&quot; do
+      @html = @helper.paginate(@things, :page =&gt; 2, :url =&gt; proc {|page| &quot;/some/path/#{page}&quot; })
+      @html.should have_tag(&quot;a.next[href=/some/path/3]&quot;, &quot;Next page&quot;)
+      @html.should have_tag(&quot;a.previous[href=/some/path/1]&quot;, &quot;Previous page&quot;)
+    end
+    
     it &quot;should have current page number&quot; do
       @helper.paginate(@things, '/some/path').should have_tag(&quot;ul.paginate&quot;) do |ul|
         ul.should have_tag(&quot;li.page.page-1&quot;) do |li|</diff>
      <filename>spec/has_paginate_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7ccd65f1efcd3b0bcef43d7e08d8ae02695d035a</id>
    </parent>
  </parents>
  <author>
    <name>Nando Vieira</name>
    <email>fnando.vieira@gmail.com</email>
  </author>
  <url>http://github.com/fnando/has_paginate/commit/9e12ae51387e98a5e2810fa84d1f0a4ef564b10c</url>
  <id>9e12ae51387e98a5e2810fa84d1f0a4ef564b10c</id>
  <committed-date>2009-04-27T18:33:13-07:00</committed-date>
  <authored-date>2009-04-27T18:33:13-07:00</authored-date>
  <message>The paginate helper can accept a proc as URL generator; check it out the README.</message>
  <tree>cd5c6d400bd44e7894359fd66aefdb715be632a2</tree>
  <committer>
    <name>Nando Vieira</name>
    <email>fnando.vieira@gmail.com</email>
  </committer>
</commit>
