Skip to content

Commit

Permalink
Default attr_lazy is nil for new_record?.
Browse files Browse the repository at this point in the history
  • Loading branch information
kstephens committed Apr 6, 2011
1 parent e656d17 commit 5df637a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contenter_gui/lib/attr_lazy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def read_lazy_attribute(att)
if @attributes.has_key? att
@attributes[att]
else
@attributes[att] = self.class.find(self[self.class.primary_key], :select => att)[att]
@attributes[att] =
self[self.class.primary_key] ?
self.class.find(self[self.class.primary_key], :select => att)[att] :
nil
end
end

Expand Down

0 comments on commit 5df637a

Please sign in to comment.