[MacRuby-devel] Sequel and macruby
Wladjmir Godioz
wladjmir at gmail.com
Wed Sep 7 09:15:07 PDT 2011
Hi,
in my first experience with sequel, i installer sqlite3 and sequel gems without problem, then i tried to run the simple example in readme.doc of sequel
require 'rubygems'
require 'sequel'
DB = Sequel.sqlite # memory database
DB.create_table :items do
primary_key :id
String :name
Float :price
end
items = DB[:items] # Create a dataset
# Populate the table
items.insert(:name => 'abc', :price => rand * 100)
items.insert(:name => 'def', :price => rand * 100)
items.insert(:name => 'ghi', :price => rand * 100)
# Print out the number of records
puts "Item count: #{items.count}"
# Print out the average price
puts "The average price is: #{items.avg(:price)}"
without any error the output is:
Item count: 0
The average price is:
someone has info to get it work.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110907/cc319212/attachment.html>
More information about the MacRuby-devel
mailing list