From: Chuck Remes Date: 2007-10-23T06:14:55+09:00 Subject: How do I save a row update using Sequel? I really like the simplicity of Sequel [1], but right now it is giving me fits. After I insert a row into the database, I can't seem to get it to persist any updates that I make to that row. Here's an example. [cremes@calvin tmp]$ sqlite3 test.db SQLite version 3.5.1 Enter ".help" for instructions sqlite> create table test_table (a text, b text, c text); sqlite> .tables test_table [cremes@calvin tmp]$ sequel 'sqlite:///test.db' Your database is stored in DB... irb(main):001:0> d = DB[:test_table] => #[:test_table]}, @row_proc=nil, @db=#, @statement_factory=SQLite3::Statement, @results_as_hash=false, @handle=#, @transaction_active=false, @closed=false, @translator=nil>], @connection_proc=#, @created_count=1, @mutex=#, @allocated={}, @max_size=4>, @opts= {:password=>nil, :host=>nil, :port=>nil, :database=>"test.db", :user=>ni l}, @logger=nil, @single_threaded=false>> irb(main):002:0> d.all.count NoMethodError: undefined method `count' for []:Array from (irb):2 irb(main):003:0> d.all => [] irb(main):004:0> d << {:a => 'sample1', :b => 'sample2'} => 1 irb(main):005:0> d.all => [{:b=>"sample2", :a=>"sample1", :c=>nil}] irb(main):006:0> d.filter('a = ?', 'sample1').order(:b).last.update (:c => 'sample3') => {:b=>"sample2", :a=>"sample1", :c=>"sample3"} irb(main):007:0> d.all => [{:b=>"sample2", :a=>"sample1", :c=>nil}] irb(main):008:0> Notice how 'sample3' goes missing after the +update+ method executes. The result from that call clearly shows a hash with that field updated, but when I ask the database to print that row it doesn't show up. I tried executing a +save+ but that method isn't defined on Array. Can anyone help me out? cr