Created
October 3, 2009 17:22
-
-
Save teamon/200759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0.9.11 | |
~/Desktop % ruby dm-test.rb | |
#<DateTime: 106057986779/43200,0,2299161> | |
#<DateTime: 106057986779/43200,0,2299161> | |
# 0.10.0 | |
~/Desktop % ruby dm-test.rb | |
{"month"=>"08", "hour"=>"11", "day"=>"2", "year"=>"2009", "min"=>"45"} | |
/opt/local/lib/ruby/gems/1.8/gems/data_objects-0.10.0/lib/data_objects/quoting.rb:26:in `quote_value': Don't know how to quote Hash objects ({"month"=>"08", "hour"=>"11", "day"=>"2", "year"=>"2009", "min"=>"45"}) (RuntimeError) | |
from /opt/local/lib/ruby/gems/1.8/gems/data_objects-0.10.0/lib/data_objects/command.rb:68:in `escape_sql' | |
from /opt/local/lib/ruby/gems/1.8/gems/data_objects-0.10.0/lib/data_objects/command.rb:61:in `gsub!' | |
from /opt/local/lib/ruby/gems/1.8/gems/data_objects-0.10.0/lib/data_objects/command.rb:61:in `escape_sql' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/adapters/data_objects_adapter.rb:162:in `execute_non_query' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/adapters/data_objects_adapter.rb:162:in `execute' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/adapters/data_objects_adapter.rb:266:in `with_connection' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/adapters/data_objects_adapter.rb:160:in `execute' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/adapters/data_objects_adapter.rb:58:in `create' | |
... 7 levels... | |
from /opt/local/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/hook.rb:297:in `create_hook' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/resource.rb:567:in `save_self' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/resource.rb:333:in `save' | |
from dm-test.rb:20 | |
zsh: exit 1 ruby dm-test.rb | |
~/Desktop % | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
gem "dm-core", "0.10.0" | |
require "dm-core" | |
class Lecture | |
include DataMapper::Resource | |
property :id, Serial | |
property :date, DateTime | |
end | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
DataMapper.auto_migrate! | |
params = {"month"=>"08", "hour"=>"11", "day"=>"2", "min"=>"45", "year"=>"2009"} | |
lec = Lecture.new | |
lec.date = params | |
puts lec.date.inspect | |
lec.save | |
puts lec.date.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment