[英]How does ActiveRecord convert a hash to JSONB?
I have a hash that contains only string keys and simple datatypes that are compatible with JSON (numeric values, arrays, string, and objects containing the same). 我有一个哈希,其中仅包含与JSON兼容的字符串键和简单数据类型(数字值,数组,字符串和包含它们的对象)。
I'd like to know what ActiveRecord (or any other layers involved) does to translate that ruby hash into the SQL statement that stores it in a JSONB column. 我想知道ActiveRecord(或涉及的其他任何层)如何将红宝石哈希值转换为将其存储在JSONB列中的SQL语句。
Using rails 4.2.7.1
, and pg 0.20.0
使用
rails 4.2.7.1
和pg 0.20.0
Does ActiveRecord just call #to_json
on the hash, and the resulting String
is put in the SQL query, and that's it? ActiveRecord是否仅在哈希上调用
#to_json
,并将生成的String
放入SQL查询中,仅此而已?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.