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

inserted id #94

Closed
diogomaximo opened this issue May 3, 2013 · 1 comment
Closed

inserted id #94

diogomaximo opened this issue May 3, 2013 · 1 comment

Comments

@diogomaximo
Copy link

How can i get the inserted ids of my array object?
Can i do something like that:
ids = Entry.import entries

@jkowens
Copy link
Collaborator

jkowens commented Apr 4, 2016

@diogomaximo if using Postgres and activerecord-import 0.8.0+ you can do

result = Entry.import entries
ids = result.ids

Issue #247 would provide the same functionality to MySQL and SQLite once implemented.

Otherwise you could possibly make a work around by setting the created_at timestamp or some import identifier and querying by that to get the records with their ids from the database.

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