Attempting to use the 'Intelligent hash condition mapping' I was trying to get the following SQL:
SELECT histories.*, count(*), sum(vendor_earnings) FROM `histories`
so I tried the following:
History.select( [ { :histories => '*' }, :count.func( '*' ), :sum.func( :vendor_earnings) ] ).to_sql
But it didn't work. Two things wrong as you can see in what it actually produced:
> History.select( [ {:histories => '*' }, :count.func( '*' ), :sum.func( :vendor_earnings) ] ).debug_sql
=> "SELECT '--- \\n:histories: \\\"*\\\"\\n', count('*'), sum(vendor_earnings) FROM `histories`"
The two issues are
'*' instead of just *
- The odd yaml
Its possible I'm just using MetaWhere for something its not designed for (select vs where) but its tantalisingly close to Just Working.