search for: loaded_version

Displaying 1 result from an estimated 1 matches for "loaded_version".

2009 Mar 25
11
ActiveRecord: Nested :include erroneous behavior
...class Shop < ActiveRecord::Base belongs_to :agent end Schema - http://pastie.org/426261 def test_should_load_avatars shop_1= Shop.create! shop_2= Shop.create! book= Book.create!(:distributors => [Distributor.create!(:agents=> [Agent.create!(:shops => [shop_2, shop_2])])]) loaded_version = Book.find(book.id, :include => [:distributors => {:agents => :shops}], :order => ''shops.id'') assert(loaded_version.distributors.first.agents.first.shops.size == 2) #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2 end On some investigation, I found th...