Skip to content

Instantly share code, notes, and snippets.

@scoop
Created January 16, 2009 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scoop/47860 to your computer and use it in GitHub Desktop.
Save scoop/47860 to your computer and use it in GitHub Desktop.
class Project < ActiveRecord::Base
define_index do
indexes :name
indexes :description
has tags(:id), :as => :tag_ids
end
end
Project.faceted_search :group_by => :tag_ids
# => { #<Tag id: 1, name: "foo"> => 1, #<Tag id: 2, name: "bar"> => 3 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment