If I ‘find’ using :include, and some included associations are null,
then looping through the array executing ‘if obj[i].assoc’ accesses the
database for a second time (as obj.assoc is nil).
Topic, has_many posts
Post has_one email
posts = Post.find(:all, :condition => ‘posts.topic_id = 10’, :include =>
for post in posts do
#do something here
some post objects do not have an email address set.
then, as post.email is nil active record attempts to load the email
address, which of course is nil.
Is there a way to ‘fix’ or ‘freeze’ the post object so that it Active
Record won’t attempt to access the DB for a second time?