Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person
- include MongoMapper::Document
- end
- class Registree < Person
- key :in_wels, Boolean
- key :in_vienna, Boolean
- end
- class Visitor
- QUERY = { "$or" => [{:in_wels => true}, {:in_vienna => true}] }
- def new(*args)
- r = Registree.new(*args)
- r.in_wels = true
- r.in_vienna = true # okay maybe you don't want them both true, but...
- r
- end
- def find(*args)
- Registree.where(QUERY).find(*args)
- end
- end
Add Comment
Please, Sign In to add comment