You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hope the following testcase explains the problem better then any text i could write. The problem also seems to be limited to exists?, the children association itself returns an empty array.
Removing the goldiloader gem would make this test pass (just in case this questions comes to mind).
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails'#, github: 'rails/rails'
gem 'goldiloader', github: 'salsify/goldiloader'
gem 'sqlite3'
end
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 :comments, force: true do |t|
t.integer :parent_id
end
end
class Comment < ActiveRecord::Base
has_many :children, class_name: 'Comment', foreign_key: :parent_id
end
class BugTest < Minitest::Test
def test_association_stuff
Comment.create!
assert !Comment.new.children.exists?
end
end
PS: Thank you for this nice gem.
The text was updated successfully, but these errors were encountered:
I hope the following testcase explains the problem better then any text i could write. The problem also seems to be limited to exists?, the children association itself returns an empty array.
Removing the goldiloader gem would make this test pass (just in case this questions comes to mind).
PS: Thank you for this nice gem.
The text was updated successfully, but these errors were encountered: