On 23 August 2010 21:03, Bob Smith <[email protected]> wrote:
> in my models, household has_many :people and people has_one :household
> household has a name field, and people has household_id

That should be person belongs_to household.

>
> the closest I got was:
> @test = Household.count :all, :group => 'people.household_id', :joins
> => :people
>
> this does group the families together and count the members,
> but this has no way of including only families of one
> I am assuming that the output from this could be used to get the name
> field from households

It might be worth looking at counter_cache.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to