From: For Mrperfect Date: 2007-12-05T11:43:23+09:00 Subject: @@IDENTITY I can't seem to find any resources which tell me how to do the following. When I write some content to a table in my database (mysql), I want to retrieve the id of the newly inserted record; an equivalent of select @@IDENTITY from sometable. How can I do this in ruby? In my code, I have a hash: params[:customer] = row.to_hash @customer = @asset.customers.build(params[:customer]) # now I want to store, in table x, the id of this record which was just inserted into the customers table. -- Posted via http://www.ruby-forum.com/.