Ruby 求解释下这段代码的意思,谢谢

jjzxcc · April 20, 2016 · Last by zhenning replied at April 21, 2016 · 1812 hits
scope :unread_desc, ->(unread_list) { order("id = ANY ('{#{unread_list.join(',')}}'::int[]) DESC") }

求解释order("id = ANY ('{#{unread_list.join(',')}}'::int[]) DESC"), 特别是::int[]在这里的意思,谢谢。

https://ruby-china.org/topics/6953 很久前的一篇 解释“::”和“.”的文章 你这个要连在一起看-------------------------

'{#{unread_list.join(',')}}'    ::    int[]

同不懂,好奇谷歌了下,好像是 pgsql 中的类型转换符,估计是把前面的 string 转换为 int array 吧。

You need to Sign in before reply, if you don't have an account, please Sign up first.