This project is archived and is in readonly mode.
[PATCH] Refactoring AssociationProxy and subclasses to avoid @finder_sql, @counter_sql, etc
This is another refactoring patch extracted from my work on nested through associations (see #1152).
Currently there is a rather confusing mix of variables such as
@counter_sql, etc. They are
used in different ways at different times, and due to the use of
inheritance it's quite hard to follow what is getting set or used
The patch implements a level of consistency across all
construct_scopeon initialization, which calls
construct_create_scopeand assigns the results in a
construct_create_scopeare then implemented by subclasses
@scopevariable is used by the subclasses when performing queries
:counter_sqlare used, they are dealt with by the new methods
custom_counter_sql(previously they would be assigned to
@finder_sqlor whatever, but depending on the situation
@finder_sqlwould either be passed to the
:conditionsof the scope, or passed directly to
Hope this makes sense, let me know if further explanation is needed.
(You can see the commit in the nested through associations fork here: http://github.com/bjeanes/rails/commit/78b8c51cb3b0c629152f3bbaf6d8...)
Comments and changes to this ticket
Damn! Thanks for taking the time to look at this and really sorry that I messed it up. It looks like a teeny bit of my nested associations patch slipped through the net here. I don't know how that happened. Sorry.
It was a one line fix which I've applied - updated patch attached. I've run all the tests and they work.
Is it possible to re-mark this as "open" as I have fixed the patch? I've re-applied and tested it today, it still applies cleanly and works. Just don't want it to get buried and forgotten, especially as I'm thinking that this needs to get in before the overall nested through associations patch can be looked at easily.
Thanks very much,
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>