Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

Odd YAML output when passing to select() #23

@ashb

Description

@ashb

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

  1. '*' instead of just *
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions