Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixture Load Breaks on has_and_belongs_to_many :companies, inverse_of: nil #3

Open
adailey14 opened this issue Oct 24, 2015 · 3 comments

Comments

@adailey14
Copy link

I have two models like this:

class Item
include Mongoid::Document
field :name, type: String
has_and_belongs_to_many :other_items, inverse_of: nil
end

class OtherItem
include Mongoid::Document
field :name, type: String

has_and_belongs_to_many :items

end

Then I try to create fixtures like this:

items.yml:
item1:
name: item1
other_items:
-other_item1

other_items.yml:
other_item1:
name: other_item1

This gives me this error when trying to create the fixtures (let me know if you want a full trace):
Mongo::Error::OperationFailure: An empty update path is not valid. (56)
...mongoid stack...
/bundler/gems/mongoid-fixture_set-7b7d767542f9/lib/mongoid/fixture_set.rb:109:in `update_document'

However, if I remove the inverse_of: nil from items and uncomment the has_and_belongs_to_many relation in other_items, the fixtures work as expected.

Thanks!

@Aethelflaed
Copy link
Owner

Hi !
I don't have time to maintain this repository at the moment, so I can't investigate this issue at the moment.

The projet needs a major rewrite due to some misconceptions, so I can't investigate this issue at the moment, sorry.

However, feel free to clone the sources, fix and pull request ;) If you're motivated, I can then transfer the ownership of this gem.

Geoffroy

@adailey14
Copy link
Author

Thanks for the note Geoffroy. Sorry I'm not motivated enough or feel like I
have enough background to own this gem. I have been using it in an
experimental project (and I'm just learning MongoDB) and it's been working
just fine other than the issue mentioned above - but maybe I'll switch over
to factory girl or something similar if you think this gem is too unstable
/ out of date.

On Sun, Nov 1, 2015 at 3:05 AM, @_Geoffroy notifications@github.com wrote:

Hi !
I don't have time to maintain this repository at the moment, so I can't
investigate this issue at the moment.

The projet needs a major rewrite due to some misconceptions, so I can't
investigate this issue at the moment, sorry.

However, feel free to clone the sources, fix and pull request ;) If you're
motivated, I can then transfer the ownership of this gem.

Geoffroy


Reply to this email directly or view it on GitHub
#3 (comment)
.

@Aethelflaed
Copy link
Owner

Yes, I think it's better to continue using FactoryGirl at the moment.

Maybe later will I finish my work and produce a correct port of ActiveRecord fixtures for mongoid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants