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?