#9 ✓invalid
Steven Garcia

will_paginate for single models

Reported by Steven Garcia | May 10th, 2007 @ 01:53 AM

I was trying to use this plugin and it seems like it was written for associated models (:board has_many :posts)

How should I write my controller code for cases when there is no parent model? Is this even possible?

Comments and changes to this ticket

  • PJ Hyett

    PJ Hyett May 10th, 2007 @ 01:53 AM

    • State changed from “new” to “open”

    You're free to use this with any object or association.

    All you need is a subset of objects and a total count of all of those objects that fit your criteria to use this plugin. There's a lot of functionality given automatically, but you're free to override most of it.

    If that sounds like a vague answer, perhaps you could post some code to let me know what you're trying to do.

  • Mislav

    Mislav May 10th, 2007 @ 01:53 AM

    • State changed from “open” to “invalid”

    It's clear to me that Steven didn't understand that "paginate" methods is just a wrapper (kinda) for "find", so they can do anything "find" can.

    Anyway, [203]:http://require.errtheblog.com/plugins/changeset/203 adds many finder tests to the plugin which pass in the most simple and complex scenarios. I'm closing this because the finder doesn't have to operate on associated models.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Everyone's favorite Ruby library for pagination of practically anything!

People watching this ticket

Pages