Forum: Ruby on Rails Active Record questions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A771b8b162063627eb5a22e3ea1886d3?d=identicon&s=25 dparkmit (Guest)
on 2007-04-14 18: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
deadlock?
This topic is locked and can not be replied to.