我可以在belongs_to关联中使用jsonb字段作为foreign_key吗?大致如下:
belongs_to :product, class_name: "Product", foreign_key: "data ->'product_id'"
只能在列(或列组)之间定义引用,如中所述文档 http://www.postgresql.org/docs/9.4/static/sql-createtable.html:
外键 ( 列名 [ ... ] ) 引用 reftable [ ( refcolumn
[...])]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)