我运行如下查询:
rs = conn.execute("SELECT * FROM fruits WHERE name = 'apple' AND type = 'sweet'" )
puts "Results = #{rs.inspect}"
这给了我类似的东西
Results = [{"fruitId"=> 123, "name"=>"apple", "type"=>"sweet" }]
我如何从中得到fruitId?
我试过这个:
puts "Retrieved fruitId = #{rs['fruitId'] }"
但这会导致错误: [] no implicit conversion of string to integer
我怎样才能得到fruitId?
谢谢