Item's page and will_paginate?

Introducing the ONLY search engine optimization software product that has been 100% PROVEN to dramatically increase your rankings in Google, Yahoo, and Bing. Get it now!

In other words. If you photo has ID 40 and there are 25 records before (assuming some records has been deleted), with 20 records per page.

Page = (number_of_records_before_RECORD / number_of_pages) + 1 In other words. If you photo has ID 40 and there are 25 records before (assuming some records has been deleted), with 20 records per page: page = (25 / 20) + 1 = 2 You can count the number of records before selected record using Model. Count(:conditions => 'id 'id').

The right query depends on which sorting filter you apply to that table when listing all objects.

This may be a solution, but I wonder why this code isn't implemented by default in the plugin. Maybe because it doesn't make sense to do what I said in terms of performance.. – collimarco Jun 30 '09 at 19:23 Because it doesn't really make sense for a broad audience. This isn't a perfect solution but just a workaround for your specific need.

Also, will_paginate provide pagination facilities, not additional ActiveRecord functionalities. – Simone Carletti Jun 30 '09 at 19:55 1 I wouldn't have thought it would be a huge performance hit. When you're using a pagination library it will count all of the things you are paging to get the total page count.

Provided the column you are ordering on is indexed correctly then it shouldn't be too painful to get a similar count to find the current page. – Shadwell Jun 30 '09 at 20:00 It's also worth, if you can, doing the count to find the current page in the same transaction as the query to find the items in the page - otherwise a user may find themselves at a page which doesn't have the photo they were expecting on because the number of photos has changed between queries. – Shadwell Jun 30 '09 at 20:03 I agree wutg Shadwell, this is the reason why I commented "This isn't a perfect solution but just a workaround for your specific need" and one of the best reason why this doesn't really make sense in will_paginate.

If you want such this feature, you should code it in the way it best fits your application and requirements. – Simone Carletti Jun 30 '09 at 20:22.

The page number is highly dependent on the results of your search. Your search might have 1, 10, or 100 pages depending on the result set and the number of items per page. Any link to "show all photos" could contain the search and pagination information, using the GET parameters as you've described.

Or store and retrieve via a cookie so that the search results persist until the users clears or selects a new search.

The problem is that when the user temporary leaves the photo page (for example to modify it) and then tries to return back to show all photos he always returns to the first page :( While I don't think using cookies it is a good thing for SEO. – collimarco Jun 30 '09 at 18:52 1 @collimarco If you want to reuse search and paginations parameters between requests, then you'll need to persist them somewhere. That's usually what cookies are for.

Not sure what impact this would have on SEO. – Terry Lorber Jun 30 '09 at 19:09 I saw that many photography sites (such as deviantart. Com) use cookies to allow users to go back.

– collimarco Jun 30 '09 at 19:38.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions