Created
January 13, 2014 15:35
-
-
Save chasballew/8402375 to your computer and use it in GitHub Desktop.
Rails/rails issue #13683 - https://github.com/rails/rails/issues/13683
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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end | |
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 :admin_posts do |t| | |
end | |
create_table :admin_comments do |t| | |
end | |
create_join_table :admin_comments, :admin_posts | |
end | |
class AdminPost < ActiveRecord::Base | |
has_and_belongs_to_many :admin_comments | |
end | |
class AdminComment < ActiveRecord::Base | |
has_and_belongs_to_many :admin_posts | |
end | |
class BugTest < Minitest::Test | |
def test_association_stuff | |
post = AdminPost.create! | |
comment = AdminComment.create! | |
comment.admin_posts << post | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fails with: