Add inverse of add target #12443

Merged
merged 2 commits into from Oct 4, 2013

Projects

None yet

2 participants

@arthurnn
Member
arthurnn commented Oct 4, 2013

Follow up with fix for #12413.

Add back set_inverse_instance on .add_to_target
We must have it in there too, so when an existent record is being concat to another, we will have the inverse relation.

This line is there on master. So we should add it back.
https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/collection_association.rb#L378

review @rafaelfranca

@arthurnn arthurnn Add back set_inverse_instance on .add_to_target
We must have it in there too, so when an existent record is being concat to another,
we will have the inverse relation.
655396c
@rafaelfranca
Member

Can't we add a regression test?

@arthurnn
Member
arthurnn commented Oct 4, 2013

👍 yes we can ! Will look into it.

@arthurnn
Member
arthurnn commented Oct 4, 2013

It would be nice to add the same regression test into master, as if we remove the same line in there, all tests pass.
So should I commit the regression test in a separate commit, than you cherry-pick to there? Or should I create another PR only with the regression test.

@rafaelfranca
Member

both options are fine to me. Your call

@arthurnn
Member
arthurnn commented Oct 4, 2013

Done... if you could then cherry-pick fc59e99 into master, and maybe 4.0-stable, would be nice.

@rafaelfranca rafaelfranca merged commit 7ed5bdc into rails:3-2-stable Oct 4, 2013

1 check passed

default The Travis CI build passed
Details
@arthurnn arthurnn deleted the arthurnn:add_inverse_of_add_target branch Oct 4, 2013
@rafaelfranca
Member

Done

@rafaelfranca rafaelfranca added a commit that referenced this pull request Oct 10, 2013
@rafaelfranca rafaelfranca Revert "Merge pull request #12443 from arthurnn/add_inverse_of_add_ta…
…rget"

This reverts commit 7ed5bdc, reversing
changes made to 31c79e2.

Reason: this caused a regression when the associated record is creted in
a before_create callback.

See #12413 (comment)
9639f65
@rafaelfranca rafaelfranca added a commit that referenced this pull request Oct 10, 2013
@rafaelfranca rafaelfranca Revert "Merge pull request #12443 from arthurnn/add_inverse_of_add_ta…
…rget"

This reverts commit 7ed5bdc, reversing
changes made to 31c79e2.

Reason: this caused a regression when the associated record is creted in
a before_create callback.

See #12413 (comment)
fbc69ac
@tenderlove tenderlove added a commit that referenced this pull request Oct 16, 2013
@tenderlove tenderlove Merge branch '3-2-15' into 3-2-sec
* 3-2-15:
  bumping to rc3
  Revert "Merge pull request #12413 from arthurnn/inverse_of_on_build"
  Revert "Merge pull request #12443 from arthurnn/add_inverse_of_add_target"
  bumping to rc2
  Merge pull request #12443 from arthurnn/add_inverse_of_add_target
  bumping version to 3.2.15.rc1
  Fix STI scopes using benolee's suggestion. Fixes #11939
eb8807e
@tenderlove tenderlove added a commit that referenced this pull request Oct 16, 2013
@tenderlove tenderlove Merge branch '3-2-sec' into 3-2-stable
* 3-2-sec:
  updating changelogs
  bumping to 3.2.15
  bumping to rc3
  Revert "Merge pull request #12413 from arthurnn/inverse_of_on_build"
  Revert "Merge pull request #12443 from arthurnn/add_inverse_of_add_target"
  bumping to rc2
  Merge pull request #12443 from arthurnn/add_inverse_of_add_target
  bumping version to 3.2.15.rc1
  Remove the use of String#% when formatting durations in log messages

Conflicts:
	activerecord/CHANGELOG.md
5f844d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment