-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
I have a set of documents that follow this basic relationship graph:
class Oauth::Consumer include Mongoid::Document embeds_many :tokens, :class_name => 'Oauth::Token', :as => "tokenable"
class Oauth::Token include Mongoid::Document embedded_in :tokenable, :inverse_of => :tokens belongs_to :consumer, :class_name => "Oauth::Consumer"
The idea being that a Token can be embedded, and can additionally reference a Consumer.
When I attempt to set consumer on a Token document mongoid determines that embeds_many :tokens is the inverse relationship to belongs_to :consumer. So, just setting the consumer causes problems since mongoid tries to set what it thinks is the inverse relationship, when there should be none.
Shouldn't mongoid be able to determine that these are not inverse relationships because they are different types (embedded vs referenced)?