There is a simple database in Sequel:
DB = Sequel.sqlite
DB.create_table :items do
primary_key :id
DateTime :date
String :name
end
items = DB[:items]
items.insert(:name => 'abc', :date => DateTime.now)
items.insert(:name => 'ghi', :date => DateTime.now)
items.insert(:name => 'def', :date => DateTime.now)
The question: is it a good idea to store 'strange' objects in database, like DateTime?
puts items.first(:name => 'ghi')[:date].year
Outputs '2010' so, well - it works. But still i'm quite curious about it. If it's nothing bad, what about filtering? Things like that:
puts items.first(:date.year => 2010)[:name]
... won't work. Is it possible to do it in other way? How?