Re: [Rails] Association count sorting

2010-07-20 Thread Colin Law
On 20 July 2010 03:22, badnaam wrote: > I have 3 models GrandPa, Pa, Kid > > GrandPa => has_many :pas > Pa => has_many kids > > When I list GrandPa I would like to present the following > > * > 1 - GrandPa_Name > > 2 - List of Pas sorted by the number ki

Re: [Rails] Association count sorting

2010-07-19 Thread Angel Robert Marquez
Kid has one pa and has one grandpa through pa Pa has one to many kids and has one grandpa Grandpa has one to many kids and has one pa <%= :name[gp] ?pa = kid if from gp? I think you should just have one model with a foreign key to parent and quantity of child including nil. On Mon, Jul 19, 201

[Rails] Association count sorting

2010-07-19 Thread badnaam
I have 3 models GrandPa, Pa, Kid GrandPa => has_many :pas Pa => has_many kids When I list GrandPa I would like to present the following * 1 - GrandPa_Name 2 - List of Pas sorted by the number kids each pa has in descending order **