Skip to content

Instantly share code, notes, and snippets.

@pinglamb
Last active August 29, 2015 14:16
Show Gist options
  • Save pinglamb/15c66f4bc8bc80bfc51f to your computer and use it in GitHub Desktop.
Save pinglamb/15c66f4bc8bc80bfc51f to your computer and use it in GitHub Desktop.
Rails Issue #19192 - reproduction script diff
diff --git a/produce.rb b/produce.rb
index 9c531f3..ad34718 100644
--- a/produce.rb
+++ b/produce.rb
@@ -31,10 +31,11 @@ ActiveRecord::Schema.define do
create_table :post_tags, force: true do |t|
t.integer :post_id
t.integer :tag_id
+ t.datetime :created_at
end
create_table :tags, force: true do |t|
- t.tag_name
+ t.string :tag_name
end
end
@@ -62,6 +63,7 @@ end
class BugTest < Minitest::Test
def test_association_stuff
+ posts = []
15.times do |i|
posts << Post.create!
@@ -71,6 +73,7 @@ class BugTest < Minitest::Test
post.tags.create!
end
+ post = posts.sample
post.comments << Comment.create!
assert_equal 15, Post.order('posts.id desc').includes(:tags).order('post_tags.created_at').limit(15).count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment