Thanks for sharing the link Ken. Certainly helped me know where to
look first.

I checked Arel's GenericCompiler#select_sql and noticed that it
already implements the "scoped" .count & .size behavior, much like
your SQL Server specific counterpart. However, for some reason, when
using Rails 3.0.0.rc with Arel 0.4.0 it returns the values I've
mentioned in my initial post. Odd, considering that it apparently
falls back to arel's MySqlCompiler, which in turn will rely on
GenericCompiler#select_sql. Probably missing something there.

Unfortunately I also appear to be missing the reason why, when playing
with the GenericCompiler's code (http://gist.github.com/507110), my
monkey patched version has has the value of self is set to
Arel::Project, forcing me not only to redefine build_clauses but also
to use #send on the methods such as select_clauses.

Regardless of that, after checking your code, I could get both count
and size to return the expected value: 5. Furthermore, I've made
ActiveRecord::Calculations#execute_simple_calculation only drop
the :order clause should the adapter be set to PostgreSQL.

All this bring up three questions
1) where is GenericCompiler#select_sql being redefined / altered in a
way that prevents it from executing the "scoped" count?
2) what would be the best way to get around the need to redefine
build_clauses and use the #send method on relation?
3) any foreseeable impact in the change to
ActiveRecord::Calculations#execute_simple_calculation?

Best regards,
DBA

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-c...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to