Guest User

Untitled

a guest
Apr 17th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. require "rubygems"
  2. require "activerecord"
  3.  
  4. # ActiveRecord::Base.establish_connection :adapter=>"oracle_enhanced",:username=>"hr",:password=>"hr",:database=>"orcl"
  5. ActiveRecord::Base.establish_connection :adapter=>"jdbcsqlite3", :database=>"jruby_test.sqlite3", :timeout => 5000
  6.  
  7. ActiveRecord::Schema.define do
  8. suppress_messages do
  9. create_table :posts, :force => true do |t|
  10. t.string :title
  11. end
  12. create_table :comments, :force => true do |t|
  13. t.string :body
  14. t.integer :post_id
  15. end
  16. end
  17. end
  18.  
  19. class Post < ActiveRecord::Base
  20. has_many :comments
  21. end
  22.  
  23. class Comment < ActiveRecord::Base
  24. belongs_to :post
  25. end
  26.  
  27. p = Post.create(:title => "test")
  28. p.comments.create(:body => "test")
  29.  
  30. # JRuby 1.4RC1 will return false which is wrong
  31. puts Post.first.comments == Post.first.comments
Add Comment
Please, Sign In to add comment