Michael, construct_sql is executed in the initialize method of the association and it handles the substitution of the sql.
Cody On 1/19/06, Michael Schoen <[EMAIL PROTECTED]> wrote: > I can submit a patch, but wanted to confirm I'm looking at this right... > > The docs indicate that if you specify a has_many association with > :finder_sql, but no :counter_sql, it constructs the appropriate counter > sql by substituting the SELECT clause. > > But has_many_association.rb doesn't seem to do that -- it just passes > Base#count_by_sql the finder_sql, which doesn't work so good. > > def count(runtime_conditions = nil) > if @reflection.options[:counter_sql] > @reflection.klass.count_by_sql(@counter_sql) > elsif @reflection.options[:finder_sql] > @reflection.klass.count_by_sql(@finder_sql) > > Am I missing something, or should I submit a patch? > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core > _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core