[back_assignments] create fixture models and spec titles#190
Open
yarmand wants to merge 22 commits intocouchrest:masterfrom
Open
[back_assignments] create fixture models and spec titles#190yarmand wants to merge 22 commits intocouchrest:masterfrom
yarmand wants to merge 22 commits intocouchrest:masterfrom
Conversation
added 12 commits
January 20, 2015 18:49
- unset belongs_to when setting origin to nil - set/unset collection_of
model.base.rb to be able to define a after_save for dirty associations.
- do not call save more than once - propagate save for collection_of associations
added 5 commits
March 11, 2015 23:07
b97403b to
12b54be
Compare
added 2 commits
March 15, 2015 23:27
… into back_assignments Conflicts: spec/fixtures/models/parent.rb spec/unit/assocations_dual_spec.rb
added 3 commits
April 10, 2015 22:38
reverse_association is specified.
Member
|
Hi! Thanks for submitting this. I can see the benefits, but I can see a fundamental flaw in the implementation. Given that CouchDB does not support transactions, you are opening the floodgates to data inconsistencies by attempting to auto-save the other documents. In my opinion, all CouchRest Model operations should be atomic, and not have cascading callbacks in order to maintain predictability. However, I like your refactoring of the "association" parts. If you'd like to submit a pull request with a set of changes to the association handling so that you can turn your changes into another gem, more than happy to add them. A gem called something like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
when two models are referencing each other as associations, affecting one model association attribute will also assign the corresponding attribute in the referenced model. Saving a model will trigger save of associated models.
This reproduce the effect of
ActiveRecordon relationel databases.belongs_toandas_manyrely on the same foreign key.*example:
without back assignments:
with back assignments:
reverse association calculation
back assignment is triggered by the presence of the
:reverse_associationoption.