From: Adam Akhtar Date: 2008-11-15T13:01:42+09:00 Subject: KirbyBase, Table Default Values not being assigned Hi Ive been using KirbyBase and got it up and working and been fine with basic stuff such as inserting and selecting. I create my own record class as well to retrieve and pass data to the table. The problem is with using default values. I cant seem to get the db to substitiute any blank (nil) values in my custom record class with the default values I specified when creating the table. When i check the table in a text editor after an insert the values are kb_nil - hence its not substituting like it should during the insert operation. Hence when I do a select on the table in question i get nil values back rather than the default values. I experimented in irb and when i dont create a custom record class it seems to work but i cant find anything in the docs that suggest i should be doing anything different if i use my own custom record class. heres is some code for you to use in irb which makes use of a custom record class called task (im making a todo list) which replicates the problem require 'kirbybase' class Task attr_accessor(:recno, :title) def Task.kb_create(recno, title) Task.new do |x| x.recno = recno x.title = title end end def initialize(&block) instance_eval(&block) end end db = KirbyBase.new tbl = db.create_table(:deleteme, :title, {:DataType=>:String, :Default=>'No Title'}) do |t| t.record_class = Task end a_task = Task.new {|r| r.title = nil} tbl.insert(a_task) tbl.select ============================================ the result of the above select --------------------------------------------- irb(main):029:0> tbl.select => [#] title should not be nil. It should be "No Title". finally here is the table file after insert 000001|000000|Task|recno:Integer|title:String:Default->No Title 1|kb_nil can anyone tell me where im going wrong on this???? -- Posted via http://www.ruby-forum.com/.