-
-
Save kares/ab2a5ca94f30816e5df6 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
require 'active_record' | |
require 'arjdbc' if defined? JRUBY_VERSION | |
puts "using ActiveRecord::VERSION = #{ActiveRecord::VERSION::STRING}" | |
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:' | |
#ActiveRecord::Base.establish_connection :adapter => 'derby', :database => 'test.derby' | |
puts "connection adapter: #{connection = ActiveRecord::Base.connection}" | |
connection.create_table('articles') { |t| t.string :name; t.datetime :datetime } | |
class Article < ActiveRecord::Base; end | |
article = Article.create! :name => 'first', :datetime => '2010-01-01T09:00:00.000Z' | |
puts "created article: #{article} with datetime: #{article.datetime}" | |
article = Article.find(article.id) | |
puts "re-read article: #{article} with datetime: #{article.datetime}" |
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
# MRI | |
using ActiveRecord::VERSION = 4.0.0 | |
connection adapter: #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x00000002e16070> | |
created article: #<Article:0x00000002e29dc8> with datetime: 2010-01-01 09:00:00 UTC | |
re-read article: #<Article:0x00000002e56490> with datetime: 2010-01-01 09:00:00 UTC | |
# JRuby | |
using ActiveRecord::VERSION = 4.0.0 | |
connection adapter: #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x36a9ac09> | |
created article: #<Article:0xb88c512> with datetime: 2010-01-01 09:00:00 UTC | |
re-read article: #<Article:0x681ac78> with datetime: 2010-01-01 09:00:00 UTC | |
# JRuby (Derby) | |
using ActiveRecord::VERSION = 4.0.0 | |
connection adapter: #<ActiveRecord::ConnectionAdapters::JdbcAdapter:0x24c13894> | |
created article: #<Article:0x7d43ebc6> with datetime: 2010-01-01 09:00:00 UTC | |
re-read article: #<Article:0x58f79d9a> with datetime: 2010-01-01 09:00:00 UTC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment