Skip to content

Instantly share code, notes, and snippets.

@durran
Created January 19, 2010 00:31
Show Gist options
  • Save durran/280536 to your computer and use it in GitHub Desktop.
Save durran/280536 to your computer and use it in GitHub Desktop.
class Company
include Mongoid::Document
has_many :projects
end
class Project
include Mongoid::Document
has_many :project_zones
has_many :incidents
has_many_related :safety_inspectors
has_one_related :safety_manager
has_one_related :project_manager
belongs_to :company, :inverse_of => :projects
end
class ProjectZone
include Mongoid::Document
belongs_to :project, :inverse_of => :project_zones
belongs_to_related :zone
end
class Incident
include Mongoid::Document
belongs_to :project, :inverse_of => :incidents
belongs_to_related :safety_issue
belongs_to_related :safety_inspector
end
class SafetyCategory
include Mongoid::Document
has_many :safety_issues
end
class SafetyIssue
include Mongoid::Document
belongs_to :safety_category, :inverse_of => :safety_issues
end
class Zone < ActiveRecord::Base
end
class SafetyInspector < ActiveRecord::Base
end
class SafetyManager < ActiveRecord::Base
end
class ProjectManager < ActiveRecord::Base
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment