The following are the models in play.
class TestEntity < ActiveRecord::Base
belongs_to :node
end
class Node < ActiveRecord::Base
belongs_to :test_group
belongs_to :build
has_many :test_entities
has_many :networks
has_many :attachments
end
class Build < ActiveRecord::Base
has_many :nodes
end
Referring to build from a test_entity via node fails. Instead of
a build object, an empty node object is returned.
>> te = TestEntity.find(1)
=> #<TestEntity id: 1, node_id: 1, node_type: "MDS", created_at: "2009-08-07 00:18:19", updated_at: "2009-08-07 00:18:19">
>> te.node
=> #<Node id: 1, node_name: "lin3", architecture: "i686", mem_size: 2048, build_id: 1, test_group_id: 1, created_at: "2009-08-07 00:18:19", updated_at: "2009-08-07 00:18:19">
>> te.node.build
=> #<Node id: nil, node_name: nil, architecture: nil, mem_size: nil, build_id: nil, test_group_id: nil, created_at: nil, updated_at: nil>
Querying for the build with the build_id succeeds.
>> build = Build.find(te.node.build_id)
=> #<Build id: 1, lbats_build_id: nil, lbats_build_name: nil, architecture: "i686", os: "GNU/Linux", os_distribution: "redhat", kernel_version: "2.6.18-128.1.1-prep", created_at: "2009-08-07 00:18:19", updated_at: "2009-08-07 00:18:19">