Last active
August 29, 2015 14:01
-
-
Save senny/f3ae65b439e801d4d31c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'bundler' | |
Bundler.setup(:default) | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
create_table :posts do |t| | |
end | |
create_table :articles do |t| | |
end | |
end | |
class Post < ActiveRecord::Base | |
self.table_name = "posts" | |
end | |
class Articles < Post | |
self.table_name = "articles" | |
end | |
class BugTest < Minitest::Test | |
def test_association_stuff | |
article = Articles.create! | |
post = Post.create! | |
assert_equal article, Articles.base_class.where(id: 1).first! | |
end | |
end |
Author
senny
commented
May 6, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment