Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does ruby on rails automatically lock active record associations when locking the active record?

Pretty basic question:

I have a model x that has_many y, and model y belong_to x.

If I lock an instance of model x with id x_id, does it also lock the associated rows in the table for model y which has has value x_id under the join column?

Or does ror locking just lock the active record and does not care about its associations?

Thanks!

like image 694
deruse Avatar asked Nov 14 '22 00:11

deruse


1 Answers

From what i know, it would not lock any associations. It just locks rows, without caring for model associations.

like image 149
Spyros Avatar answered Dec 06 '22 19:12

Spyros