Forum: Ruby on Rails Active Record questions

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
dparkmit (Guest)
on 2007-04-14 20:37
(Received via mailing list)
Hi All,

I've just started learning Ruby on Rails.  It's an amazing framework!
I have some Active Record questions.  Any help would be greatly
appreciated by this RoR n00b!

Active Record has many operations such as :counter_cache that require
multiple database queries.  In the :counter_cache example, Active
Record needs to both create/delete a record in the child table and
then increment/decrement the counter cache in the parent table.

Does Active Record execute these multiple queries within a single
database transaction?

If not, how do you ensure that both queries are completed?

If Active Record executes the queries within a transaction, then what
level of locking does Active Record use?  Also, how do you prevent
This topic is locked and can not be replied to.