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

Interoperability with Rails 6.0 insert_all? #9

Open
nimmolo opened this issue May 1, 2022 · 3 comments
Open

Interoperability with Rails 6.0 insert_all? #9

nimmolo opened this issue May 1, 2022 · 3 comments

Comments

@nimmolo
Copy link

nimmolo commented May 1, 2022

Hi @alejandrodevs - thanks for this gem! I found it by looking for a backport of the Rails 6 bulk insert function insert_all.

It seems like it uses the same syntax, is that correct? I ask because i'm wondering, if I use it in a Rails 5.2 project that one day gets updated to Rails 6, are there any changes i should think about?

@alejandrodevs
Copy link
Owner

Hi @nimmolo. I think that if you are using this gem in a basic way there is not major changes because both accept Array of Hashes as the first argument. They support different options in the second argument, for example insert_all supports the unique_by option and mass_insert supports primary_key, per_batch and handle_duplication options.

If you are not using these options, switching between gems should be very simple. Even using the options, I think it shouldn't be that hard. What I recommend you is to create your own class/module and wrap mass_insert gem functionality and in the future when you upgrade rails you will just need to change that class/module.

@nimmolo
Copy link
Author

nimmolo commented May 2, 2022 via email

@alejandrodevs
Copy link
Owner

@nimmolo I would appreciate a PR with that information. Thanks.

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