Created
February 15, 2012 13:54
-
-
Save durran/1835836 to your computer and use it in GitHub Desktop.
Embedded documents with inheritance.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contact | |
include Mongoid::Document | |
embeds_one :email | |
embeds_one :phone | |
end | |
class Detail | |
include Mongoid::Document | |
end | |
class Email < Detail | |
embedded_in :contact | |
end | |
class Phone < Detail | |
embedded_in :contact | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment