Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am paulleader on github.
  • I am paulleader (https://keybase.io/paulleader) on keybase.
  • I have a public key whose fingerprint is 5C86 AAA7 508C 851F 0296 74B8 25C2 0647 47E4 E677

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am paulleader on github.
  • I am paulleader (https://keybase.io/paulleader) on keybase.
  • I have a public key whose fingerprint is 9538 888A E695 F68E 0477 E08B 639A C21B FD82 99BA

To claim this, I am signing this object:

@paulleader
paulleader / gist:2835342
Created May 30, 2012
Facet count for an arbitrary dimension on the results of a search, uses #where_values
View gist:2835342
def facet_count(facet)
# Work out some useful strings.
facet_table = facet.table_name
facet_sym = facet_table.to_sym
facet_id_name = facet.name.foreign_key
# Build the base query in terms of the
# model being used to facet the results.
#
# We join to Company as that is used to filter