这里真的很困惑,我认为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}
我做错了什么,或者这是现在的新方式?
谢谢!