<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Pagination in Rails</title>
	<atom:link href="http://www.nullislove.com/2007/05/24/pagination-in-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/</link>
	<description>Code for Coders</description>
	<pubDate>Thu, 28 Aug 2008 13:52:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Kevin Skoglund</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-1193</link>
		<dc:creator>Kevin Skoglund</dc:creator>
		<pubDate>Sun, 29 Jun 2008 18:52:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-1193</guid>
		<description>Thanks for the heads up, Jonathan.  I have written the blog's owner.  (I removed his link from your comment so I don't compound the problem.)</description>
		<content:encoded><![CDATA[<p>Thanks for the heads up, Jonathan.  I have written the blog&#8217;s owner.  (I removed his link from your comment so I don&#8217;t compound the problem.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-1192</link>
		<dc:creator>Jonathan</dc:creator>
		<pubDate>Sun, 29 Jun 2008 17:29:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-1192</guid>
		<description>Hi,
Just to make you aware - it seems as though someone has plagiarised your content on the following website (link-removed). Great article though, thanks very much!
jonathan</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Just to make you aware - it seems as though someone has plagiarised your content on the following website (link-removed). Great article though, thanks very much!<br />
jonathan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Skoglund</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-1027</link>
		<dc:creator>Kevin Skoglund</dc:creator>
		<pubDate>Tue, 19 Feb 2008 16:07:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-1027</guid>
		<description>Yes, EVERY pagination technique (besides a JavaScript solution) is going to require a new query to the web server when a page link is clicked and that will result in a new SQL query.

The "single trip version" goes to the database one time per page click and gets everything it needs to render the page contents and the pagination.  It retrieves all items in the database at once.

The "multi trip version" goes to the database two times per page click.  Once to count how many items there are altogether (so it knows how many pages are possible) and a second time to get the items that show up on this page.

But each click still results in at least one SQL call.</description>
		<content:encoded><![CDATA[<p>Yes, EVERY pagination technique (besides a JavaScript solution) is going to require a new query to the web server when a page link is clicked and that will result in a new SQL query.</p>
<p>The &#8220;single trip version&#8221; goes to the database one time per page click and gets everything it needs to render the page contents and the pagination.  It retrieves all items in the database at once.</p>
<p>The &#8220;multi trip version&#8221; goes to the database two times per page click.  Once to count how many items there are altogether (so it knows how many pages are possible) and a second time to get the items that show up on this page.</p>
<p>But each click still results in at least one SQL call.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinesh</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-1022</link>
		<dc:creator>Dinesh</dc:creator>
		<pubDate>Mon, 18 Feb 2008 22:57:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-1022</guid>
		<description>Isn't the single trip version incorrect? Seems to me it will hit the database with a full query every time a page link (or next / previous) is clicked.

What am I not understanding about this?</description>
		<content:encoded><![CDATA[<p>Isn&#8217;t the single trip version incorrect? Seems to me it will hit the database with a full query every time a page link (or next / previous) is clicked.</p>
<p>What am I not understanding about this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan M</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-572</link>
		<dc:creator>Jan M</dc:creator>
		<pubDate>Fri, 05 Oct 2007 10:13:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-572</guid>
		<description>Just solved my own and max's problem, simple really:
You can do a SELECT COUNT(*) FROM table WHERE sort_field &#60; updated_value
The sort_field is whatever you use in the ORDER BY clause in the paginator and updated_value is the value of that field in the recently created or updated item. Divide the result by the page size to get the page number to feed to the paginator. (Seems like a nice feature to include in a paginator library by the way...)</description>
		<content:encoded><![CDATA[<p>Just solved my own and max&#8217;s problem, simple really:<br />
You can do a SELECT COUNT(*) FROM table WHERE sort_field &lt; updated_value<br />
The sort_field is whatever you use in the ORDER BY clause in the paginator and updated_value is the value of that field in the recently created or updated item. Divide the result by the page size to get the page number to feed to the paginator. (Seems like a nice feature to include in a paginator library by the way&#8230;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan M</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-570</link>
		<dc:creator>Jan M</dc:creator>
		<pubDate>Fri, 05 Oct 2007 09:46:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-570</guid>
		<description>I have the same problem as Max: I want to jump to the page with the last change on it after an update. Seems like a reasonable thing that lots of people want to do right?

The only thing I can think of is reading in all article IDs and calculate the page from that and then read all the fields for just that page. Still seems wasteful for large collections. But there does not seem to be a SQL query to give you the position of a record in a sorted list so I guess that's the only way.</description>
		<content:encoded><![CDATA[<p>I have the same problem as Max: I want to jump to the page with the last change on it after an update. Seems like a reasonable thing that lots of people want to do right?</p>
<p>The only thing I can think of is reading in all article IDs and calculate the page from that and then read all the fields for just that page. Still seems wasteful for large collections. But there does not seem to be a SQL query to give you the position of a record in a sorted list so I guess that&#8217;s the only way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-521</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Fri, 31 Aug 2007 20:16:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-521</guid>
		<description>pagination_links() can preserve additional query parameters via the :params option.  

pagination_links( @item_pages, :params =&#62; {:myfield =&#62; params[:myfield]} )

No need to manually make your own using a for-loop.  Besides you can use the pagination_links_each() method to customize the output rather than using a for-loop.  If you look at the source code, you'll see that pagination_links() wraps pagination_links_each().</description>
		<content:encoded><![CDATA[<p>pagination_links() can preserve additional query parameters via the :params option.  </p>
<p>pagination_links( @item_pages, :params =&gt; {:myfield =&gt; params[:myfield]} )</p>
<p>No need to manually make your own using a for-loop.  Besides you can use the pagination_links_each() method to customize the output rather than using a for-loop.  If you look at the source code, you&#8217;ll see that pagination_links() wraps pagination_links_each().</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Skoglund</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-468</link>
		<dc:creator>Kevin Skoglund</dc:creator>
		<pubDate>Mon, 13 Aug 2007 20:18:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-468</guid>
		<description>The only way to do that would be to scan through each of the pages looking for that article_id.

I'm not sure what you are trying to do, but my guess is there is an easier way than determining the page with that article on it.</description>
		<content:encoded><![CDATA[<p>The only way to do that would be to scan through each of the pages looking for that article_id.</p>
<p>I&#8217;m not sure what you are trying to do, but my guess is there is an easier way than determining the page with that article on it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: max williams</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-467</link>
		<dc:creator>max williams</dc:creator>
		<pubDate>Mon, 13 Aug 2007 17:13:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-467</guid>
		<description>Actually Kevin i have a question - my list page is a list of articles.  Given an article_id, do you know how i would get the number of the page with that article on it?

thanks!
max</description>
		<content:encoded><![CDATA[<p>Actually Kevin i have a question - my list page is a list of articles.  Given an article_id, do you know how i would get the number of the page with that article on it?</p>
<p>thanks!<br />
max</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: max williams</title>
		<link>http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-466</link>
		<dc:creator>max williams</dc:creator>
		<pubDate>Mon, 13 Aug 2007 11:41:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/05/24/pagination-in-rails/#comment-466</guid>
		<description>Hi Kevin, thanks for the excellent tutorial - my list page is lovely now :)</description>
		<content:encoded><![CDATA[<p>Hi Kevin, thanks for the excellent tutorial - my list page is lovely now <img src='http://www.nullislove.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
