锁定活动记录时,轨道上的ruby会自动锁定活动记录关联吗?(does ruby on rails automatically lock active record associations when

编程入门 行业动态 更新时间:2024-10-15 06:17:59
锁定活动记录时,轨道上的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.

更多推荐

本文发布于:2023-08-07 02:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1458730.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:轨道   rails   automatically   lock   ruby

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!