Reputation: 7639
i am trying to retrieve a row from a dataset my model class is
require 'sequel' class Item < Sequel::Model end
and one my hello.rb file is
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
its giving me output
#<Item:0xb693996c>
i want to get all the columns of the row whose id field is 1 what should be the query??
Upvotes: 0
Views: 126
Reputation: 3326
try
puts Item.filter(:id =>'1').first.inspect
or
puts Item.filter(:id =>'1').first.to_yaml
(for better formatting if you have yaml
required in your code like so require 'yaml'
)
Upvotes: 1