On Lunes, 28 de Septiembre de 2009 22:19:43 alexp escribió: > I still get this extra sql call for the count > > ←[4;35;1mSQL (0.0ms)←[0m ←[0mSELECT count(*) AS count_all FROM > `players` INNER JOIN `teams` ON `players`.team_id = `teams`.id WHERE > ((`teams`.manager_id = 9)) ←[0m > > ←[4;36;1mPlayer Load (0.0ms)←[0m ←[0;1mSELECT last_name FROM > `players` INNER JOIN `teams` ON `players`.team_id = `teams`.id WHERE > ((`teams`.manager_id = 9)) LIMIT 3←[0m
Do you have a players_count in manager? Or do you want a select sum(teams.players_count) query? I have tried it and it's working for me adding a table_count column to model with has_many :through. When the counter is nil a select count query is made, but setting the column as not null default 0 fixes this. I'm using rails 2.3.4, I don't know whether it works with older versions. -- Sergio Cambra .:: entreCables S.L. ::. Mariana Pineda 23, 50.018 Zaragoza T) 902 021 404 F) 976 52 98 07 E) [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
