Wednesday, May 07, 2008

will_paginate with acts_as_taggable_on_steroids

How to paginate when searching tags with the combination of will_paginate and acts_as_taggable_on_steroids. Here is the paginate call:



Here, conditions_for_doohickies represents a function that produces the proper conditions from the supplied params. This can, of course, be done as an AND or an OR. If you want to return doohickies that have any of the tags (OR) you would do it like this:



And, if you want to return doohickies that have all of the tags (AND) you would do it like this:

No comments:

Post a Comment