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

Recursively import all has_one/has_many associations #230

Closed
wants to merge 1 commit into from

Conversation

sferik
Copy link
Contributor

@sferik sferik commented Feb 5, 2016

This should work for all has_one/has_many associations, not just ones explicitly marked autosave.

@sferik sferik force-pushed the reflect-on-all-has_many branch 2 times, most recently from 7b9b676 to e0002ec Compare February 5, 2016 02:12
@sferik sferik changed the title Recursively import all has_many associations, not just autosave Recursively import all has_many/has_one associations Feb 5, 2016
@sferik sferik force-pushed the reflect-on-all-has_many branch 2 times, most recently from e0004e0 to e0006a5 Compare February 9, 2016 23:53
@@ -462,7 +461,7 @@ def import_associations(models, options)
def find_associated_objects_for_import(associated_objects_by_class, model)
associated_objects_by_class[model.class.name]||={}

model.class.reflect_on_all_autosave_associations.each do |association_reflection|
model.class.reflect_on_all_associations(:has_many).each do |association_reflection|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might need to be revised to include :has_one associations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That can be added once #234 is merged.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sferik , #234 just got merged in. :)

@jkowens
Copy link
Collaborator

jkowens commented Feb 16, 2016

👍

@sferik sferik changed the title Recursively import all has_many/has_one associations Recursively import all has_many associations Feb 18, 2016
@sferik sferik force-pushed the reflect-on-all-has_many branch from e0006a5 to 2aca18b Compare February 22, 2016 03:10
@sferik sferik changed the title Recursively import all has_many associations Recursively import all has_one/has_many associations Feb 22, 2016
@sferik
Copy link
Contributor Author

sferik commented Feb 22, 2016

@zdennis I just rebased this branch from master and added back support for has_one associations.

@zdennis
Copy link
Owner

zdennis commented Feb 22, 2016

Awesome! Thanks @sferik!

@sferik
Copy link
Contributor Author

sferik commented Feb 22, 2016

@zdennis As you’re well aware, the tests are failing due to an issue with em-synchrony, which you reported one month ago and has received no response. That project shows no sign of being updated to work with Active Record 5. According to this open issue, it still doesn’t work with Active Record 4.2.1, which was released on March 19, 2015. In fact, the last commit to em-synchrony was on March 16, 2015, almost a year ago.

At this point, I think dropping support for em-synchrony is the right thing to do for this project. If someone wants to use activerecord-import with em-synchrony, they can take ownership over getting the test build passing with it. In the mean time, I will open a pull request that removes em-synchrony from the test suite and turns the build green. You can merge it if/when you agree with this assessment.

@zdennis
Copy link
Owner

zdennis commented Feb 26, 2016

Closing this in favor of #243 which builds on this PR. Thanks for your work on this @sferik.

Also em-synchrony and mysql have been removed in #239.

@zdennis zdennis closed this Feb 26, 2016
@zdennis
Copy link
Owner

zdennis commented Feb 26, 2016

This has been included in the 0.12.0 release.

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

Successfully merging this pull request may close these issues.

3 participants