Cyclic relationships in 2.2.0?

167 views
Skip to first unread message

Peck

unread,
Sep 11, 2011, 11:12:34 PM9/11/11
to Mongoid
Having some trouble with my models when upgrading to 2.2.0 (and trying
to fix some of the memory issues with habt relationships).

my User class has this relationship:

belongs_to :parent, :class_name => 'User', :cyclic =>
true, :inverse_of => :children, :autosave => true
has_many :children, :class_name => 'User', :cyclic =>
true, :inverse_of => :parent, :autosave => true

And is now giving the error:

Mongoid::Errors::InvalidOptions: Invalid option :cyclic provided to
relation :parent. Valid options are: autosave, foreign_key, index,
polymorphic, class_name, extend, inverse_class_name, inverse_of, name,
relation, validate.
from /usr/local/lib/ruby/gems/1.9.1/gems/mongoid-2.2.0/lib/mongoid/
relations/options.rb:41:in `block in validate!'

when loading up any instances of the User model.

This had worked previously, and I'm scoured the changelogs and other
issues, but haven't seen anything that seemed related except possibly
some code changes with issue 1151?

Has anyone experienced similar issues when upgrading to 2.2.0?

Thanks

Durran Jordan

unread,
Sep 12, 2011, 3:23:04 AM9/12/11
to mon...@googlegroups.com
Cyclic was only ever used for embedded documents and now you're just getting the error showing you. Just remove the cyclic option and you should be fine.

2011/9/12 Peck <rambl...@gmail.com>

Daniel Peck

unread,
Sep 14, 2011, 4:16:37 PM9/14/11
to mon...@googlegroups.com
Thank you Durran, that fixed my problem.
Reply all
Reply to author
Forward
0 new messages