Skip to content

Instantly share code, notes, and snippets.

@nmk
Created August 9, 2010 15:59
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 nmk/515628 to your computer and use it in GitHub Desktop.
Save nmk/515628 to your computer and use it in GitHub Desktop.
class Qualification
include Mongoid::Document
field :name
end
class User
include Mongoid::Document
references_many :departments, :stored_as => :array, :inverse_of => :users
references_many :qualifications, :stored_as => :array, :inverse_of => :users
field :name
end
class Department
include Mongoid::Document
references_many :users, :stored_as => :array, :inverse_of => :users, :inverse_of => :departments do
def qualified
???
end
end
references_many :required_qualifications, :class_name => 'Qualification', :stored_as => :array, :inverse_of => :departments
field :name
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment