Here this is what we are doing:--
an_order = Order.new
an_order.name = "
Dave Thomas"
an_order.email = "
[email protected]"
an_order.address = "123 Main St"
an_order.pay_type = "check"
an_order.save
Now it will insert a new row in orders table right. I m having a ID column in that table. Now suppose after inserting this record the value of the ID corresponding to this record is 100.
Now how this 100 value came to know?
Does the previous value of ID ie 99 (Suppose) is stored somewhere in some variable/file in the ORM layer
or
before inserting this value a query was fired to know about the last inserted value
or
database is itself doing that
or
anything else???