我正在尝试从数据集中检索行,我的模型类是
需要“Sequel”类项目< Sequel::Model end
我的一个hello.rb文件是
require "rubygems"
require './post'
require "sequel"
require './item'
# connect to an in-memory database
#DB = Sequel.connect('postgres://ritesh:newpassword@localhost')
puts Item.filter(:id =>'1').first它给了我输出
#<Item:0xb693996c>我想要获取id字段为1的行的所有列,查询应该是什么??
发布于 2013-01-31 01:15:33
试一试
puts Item.filter(:id =>'1').first.inspect或
puts Item.filter(:id =>'1').first.to_yaml(为了更好地格式化,如果您的代码中需要像require 'yaml'这样的yaml )
https://stackoverflow.com/questions/14609711
复制相似问题