hstore pql 9.3,rails 4.0.3存储为符号?

时间:2014-03-14 06:06:04

标签: ruby-on-rails postgresql ruby-on-rails-4 hstore

这里真的很困惑,我认为hstore将键和值存储为字符串,但我没有在控制台中得到它。它将它们存储为哈希值,看看:

2.0.0-p247 :003 > a = Report.new
=> #<Report id: nil, name: nil, column_data: nil, user_id: nil, created_at: nil, updated_at: nil> 
2.0.0-p247 :004 > a.column_data = {key: {yes: true}, value: 'hello'}
=> {:key=>{:yes=>true}, :value=>"hello"} 
2.0.0-p247 :005 > a
=> #<Report id: nil, name: nil, column_data: {:key=>{:yes=>true}, :value=>"hello"}, user_id: nil, created_at: nil, updated_at: nil> 
2.0.0-p247 :006 > a.column_data[:key][:yes]
=> true 
2.0.0-p247 :007 > a.column_data[:key]
=> {:yes=>true} 

我做错了什么,或者这是现在的新方式?

谢谢!

0 个答案:

没有答案
相关问题