riak-ripple / ripple

A rich Ruby modeling layer for Riak, Basho's distributed database
Other
619 stars 152 forks source link

Embedded associations do not work #303

Open mattsnyder opened 12 years ago

mattsnyder commented 12 years ago

If an embedded class has associations, they cannot be saved or accessed. Results in an error

NoMethodError: undefined method `robject' for ClassName

For example:

class Box
  include Ripple::Document
  many :sides
end

class Side
  include Ripple::EmbeddedDocument
  many :holes
  embedded_in :box
end

class Hole
  include Ripple::Document
  property :descriptor, String
end

s = Side.new
s.holes << Hole.new # Results in robject error mentioned above
seancribbs commented 12 years ago

It should be an error to define a linked association on an embedded document. If you change it to :using => :stored_key, it should work.