F
For Mrperfect
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.
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.