Given the code below, how can default values be defined for the Model. (let's say the default for :name should be 'Thing').
require 'pp'
require 'sequel'
DB = Sequel.sqlite
DB.create_table :items do
primary_key :id
String :name
end
items = DB[ :items ]
class Item < Sequel::Model
end
Item.create :name => 'foobar'
Item.create
pp Item.all
# =>
# >> [#<Item @values={:name=>"foobar", :id=>1}>,
# >> #<Item @values={:name=>nil, :id=>2}>]
So, I'd like to have the second created Item set to #<Item @values={:name=>"Thing", :id=>2}> rather than :name=>nil.