Displaying 1 result from an estimated 1 matches for "shop_1".
Did you mean:
shop_2
2009 Mar 25
11
ActiveRecord: Nested :include erroneous behavior
...nd
class Distributor < ActiveRecord::Base
belongs_to :book
has_many :agents
end
class Agent < ActiveRecord::Base
belongs_to :distributor
has_many :shops
end
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'&...