jwood / tenacity

A database client independent way of managing relationships between models backed by different databases.
MIT License
118 stars 17 forks source link

Add support for calling create on an association #28

Open danielgranat opened 13 years ago

danielgranat commented 13 years ago

Failure/Error: c = myKindel.ebooks.create!(:name => "book1") NoMethodError: undefined method `create!' for []:Array

This is the way it does work: c1 = Ebook.create!(:name => "book1", :kindel_id => myKindel.id ) c2 = Ebook.create!(:name => "book2", :kindel_id => myKindel.id) myKindel.ebooks = [c1,c2]

jwood commented 13 years ago

This is currently not supported, but would definitely be a great addition. Marking it as a feature.

arjan0307 commented 11 years ago

It also seems that post.comments.build is not working as expected. Where comment is a mongoid model. It creates a comment, but it doesn't set the comment's post_id to post.id.

jwood commented 11 years ago

build is also not supported. The full list of supported methods on Tenacity associations can be found at http://rubydoc.org/github/jwood/tenacity/Tenacity/ClassMethods.

Pull requests are always welcome :-)