Skip to content

Instantly share code, notes, and snippets.

@shaunr0b
Created December 22, 2011 23:06
Show Gist options
  • Save shaunr0b/1512247 to your computer and use it in GitHub Desktop.
Save shaunr0b/1512247 to your computer and use it in GitHub Desktop.
A simple test
class Search
include Mongoid::Document
field :query, :type => Hash
field :collection
embedded_in :user
def to_criteria
Mongoid::Criteria.new( collection.titleize.constantize ).fuse( query )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment