Skip to content

Instantly share code, notes, and snippets.

@rsim
Created October 5, 2009 10:12
Show Gist options
  • Save rsim/202035 to your computer and use it in GitHub Desktop.
Save rsim/202035 to your computer and use it in GitHub Desktop.
require "rubygems"
require "activerecord"
# ActiveRecord::Base.establish_connection :adapter=>"oracle_enhanced",:username=>"hr",:password=>"hr",:database=>"orcl"
ActiveRecord::Base.establish_connection :adapter=>"jdbcsqlite3", :database=>"jruby_test.sqlite3", :timeout => 5000
ActiveRecord::Schema.define do
suppress_messages do
create_table :posts, :force => true do |t|
t.string :title
end
create_table :comments, :force => true do |t|
t.string :body
t.integer :post_id
end
end
end
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
p = Post.create(:title => "test")
p.comments.create(:body => "test")
# JRuby 1.4RC1 will return false which is wrong
puts Post.first.comments == Post.first.comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment