This project is archived and is in readonly mode.
[PATCH] Merging JOINs when chaining scopes requires same case in JOIN expression
-
Tobi
- Tag changed from 2.3.4, :joins, activerecord, named_scope to 2.3.4, :joins, activerecord, named_scope, patch
- Title changed from Merging JOINs when chaining scopes requires same case in JOIN expression to [PATCH] Merging JOINs when chaining scopes requires same case in JOIN expression
Fixed with the patch attached. Pls check solution and test...
Comparison algorithm may slow down the process, see for different approaches (including mine)
http://stackoverflow.com/questions/1103327/how-to-uniq-an-array-cas...Cheers, Tobi
-
Rohit Arondekar
- State changed from new to stale
- Importance changed from to
Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.
-
erik landerholm
I would recommend changing the Hash.new into an OrderedHash. I know this works in rails 2.3.8. mysql is specific about the order of it's joins. using a hash could result into random failures if you are using joins in your scope.
for 2.3.8 change
joins.flatten.inject(Hash.new)....to
joins.flatten.inject(ActiveSupport::OrderedHash.new)thanks.
