I asked this in a different form some weeks ago and got no response,
let me try again in hopes that I can make my question clearer.
Let’s say I have the following models
class Author < ActiveRecord::Base
class Signing < ActiveRecord::Base
Has an attribute when, which is a DateTime
Now what I want to do is find all authors who have at least one
signing scheduled on or after a particular date. In other words, I
want to exclude authors who won’t be signing on or after that date.
Since I don’t have a black belt in SQL, I’m not sure how to do this.
I think I want some kind of join of authors to signings, and a query
which groups by author and a where clause involving the maximum value
of where for each signing in the group. But I’m having a hard time
visualizing the actual SQL for this.
And for extra points, is there a way to do this with find, :include
=>, :conditions, rather than find_by_sql?
My blog on Ruby