Created
October 20, 2010 06:16
-
-
Save yelvert/635876 to your computer and use it in GitHub Desktop.
mongoid building an embedded many document with a references_many in it saves when it shouldn't
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 Formula | |
include Mongoid::Document | |
referenced_in :formula_category | |
field :quantities, :type => Array, :default => [] | |
field :directions, :type => String | |
embeds_many :formula_medications | |
end | |
class FormulaMedication | |
include Mongoid::Document | |
embedded_in :formula, :inverse_of => :formula_medications | |
referenced_in :medication, :inverse_of => :formula_medications | |
field :concentration | |
end | |
class Medication | |
include Mongoid::Document | |
field :name, :type => String | |
field :concentrations, :type => Array, :default => [] | |
field :description, :type => String | |
references_many :formula_medications | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment