This project is archived and is in readonly mode.
Added :counter_sql to valid keys for HABTM
Reported by Ernie Miller | September 24th, 2008 @ 02:37 PM | in 2.x
In #831, I submitted a patch to refactor AssociationCollection#count and fix problems with HABTM count in Ruby 1.8.7. I forgot to add :counter_sql to the list of valid keys for HABTM associations in associations.rb, as Tekin pointed out. This was causing the option to be rejected despite the documentation update stating it should work. This one-liner patch fixes that. Sorry!
(If someone wants to add a new fixture that is a HABTM association with a :counter_sql option and put in a test making sure it counts, it probably would be worthwhile. I just don't have the time to do that today, and wanted to get this in before the bug makes it into 2.2 beta.)
Comments and changes to this ticket
-
Michael Koziarski November 6th, 2008 @ 07:56 PM
This doesn't apply cleanly any more, can you rebase it and reupload it please
-
Michael Koziarski November 6th, 2008 @ 08:16 PM
Also, we clearly don't have any tests for this feature, can you add a few (even just a simple declaration of the association and assertion on the count).
-
Ernie Miller November 6th, 2008 @ 08:26 PM
Tekin,
Thanks for jumping on this so fast! You saved me the pain. :)
-
Tekin November 6th, 2008 @ 09:09 PM
No worries!
Here's an updated patch with a couple of tests. Hope that does the trick.
-
Repository November 7th, 2008 @ 08:01 AM
- State changed from new to committed
(from [32a5cfcd7f8d14407f0c00ce2cdc82b1b568438e]) Added tests for HABTM associations with counter_sql
Signed-off-by: Michael Koziarski michael@koziarski.com [#1102 state:committed] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 831 count on HABTMs broken by Ruby 1.8.7 Array.count I checked, and it hasn't been fixed in edge yet. See #110...
- 1102 Added :counter_sql to valid keys for HABTM Signed-off-by: Michael Koziarski michael@koziarski.com [#...