search for: last_insertion_id

Displaying 1 result from an estimated 1 matches for "last_insertion_id".

2006 Feb 26
2
How to capture the last DB insertion id ??
...of how to do this in Rails ? I guess I can use the ''after_save'' callback inside the model - Image - to do the processing, but how could I get hold of the last insertion id easily ? IF AR is currently not able to present this last insertion id easily, could a ''AR.last_insertion_id'' method be created and added to Ralls ? Else I guess I would have to load the Image object again with a select sql and then retrieve the id, but that seem expensive and a bit complicated. I plan to insert big batches of images in this way, ie: 100+ images in one go, so not having...