active record - grouping with joins
I want to be able to output something like the following:

    Name     Car Type 1     Car Type 2     Car Type 3
    Dave     1                    3          6
    Mike     5                    2          8

Any advice on achieving this with active record?


Models:

    class Person
    #name
     has_many :sales
    end
    
    class Sales
    	belongs_to :person
    	belongs_to :car
    end
      
    class Cars
     #type, id, name
    	has_many :sales
    end



active record - grouping with joins
===

I want to be able to output something like the following:

    Name     Car Type 1     Car Type 2     Car Type 3
    Dave     1                    3          6
    Mike     5                    2          8

Any advice on achieving this with active record?


Models:

    class Person
    #name
     has_many :sales
    end
    
    class Sales
    	belongs_to :person
    	belongs_to :car
    end
      
    class Cars
     #type, id, name
    	has_many :sales
    end


