锁定活动记录时,轨道上的ruby会自动锁定活动记录关联吗?(does ruby on rails automatically lock active record associations when locking the active record?)
很基本的问题:
我有一个has_many y的模型x,以及y属于x的模型。
如果我使用id x_id锁定了模型x的实例,是否也锁定了模型y的表中的关联行,该模型在连接列下具有值x_id?
或者是否锁定锁定活动记录并且不关心其关联?
谢谢!
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!
最满意答案
据我所知,它不会锁定任何关联。 它只是锁定行,而不关心模型关联。
From what i know, it would not lock any associations. It just locks rows, without caring for model associations.
更多推荐
发布评论