You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you add an invalid record to a linked 'many' association, it fails to save the record, but adds it to the array anyway without raising an error. Having the unsaved record in the array can then trigger a different issue (riak-ruby-client issue #32basho/riak-ruby-client#32) when you try to save the outer record.
class InnerDoc
include Ripple::Document
property :foo, String
validates_presence_of :foo
end
class OuterDoc
include Ripple::Document
many :inner_docs
end
o_d = OuterDoc.new
i_d = InnerDoc.new(:foo => nil)
o_d.inner_docs << i_d
No exception is raised, but after the above code is run, the following are true:
When you add an invalid record to a linked 'many' association, it fails to save the record, but adds it to the array anyway without raising an error. Having the unsaved record in the array can then trigger a different issue (riak-ruby-client issue #32 basho/riak-ruby-client#32) when you try to save the outer record.
This snippet reproduces the issue in 798b898:
class InnerDoc
include Ripple::Document
property :foo, String
validates_presence_of :foo
end
class OuterDoc
include Ripple::Document
many :inner_docs
end
o_d = OuterDoc.new
i_d = InnerDoc.new(:foo => nil)
o_d.inner_docs << i_d
No exception is raised, but after the above code is run, the following are true:
i_d.valid? == false
o_d.inner_docs == [ i_d ]
i_d.key == nil
The text was updated successfully, but these errors were encountered: