[Rails] Re: Help with a find

2010-10-05 Thread Marnen Laibow-Koser
Pito Salas wrote: [...] > Thanks... I am not sure how to express that as Precinct.find_. can > you say? In cases like that, I usually find it helpful to write the SQL first, then transform it into ActiveRecord find syntax. > > -- pito Best, -- Marnen Laibow-Koser http://www.marnen.org m

[Rails] Re: Help with a find

2010-10-05 Thread Pito Salas
Frederick Cheung wrote: > On Oct 5, 2:05�pm, Pito Salas wrote: >> I have a simple one to many relation: >> >> class Precinct >> � has_many :districts >> ... >> end >> >> I would like to find all Precincts that have no districts in a finder. >> Is that possible? > > You can do that with a left out

[Rails] Re: Help with a find

2010-10-05 Thread Frederick Cheung
On Oct 5, 2:05 pm, Pito Salas wrote: > I have a simple one to many relation: > > class Precinct >   has_many :districts > ... > end > > I would like to find all Precincts that have no districts in a finder. > Is that possible? You can do that with a left outer join (and then an isnull to filter