Skip to content

Commit

Permalink
Wrapped has_many association's results into LazyArray [#19 state:reso…
Browse files Browse the repository at this point in the history
…lved]
  • Loading branch information
yrashk committed Apr 29, 2008
1 parent 7290d54 commit 5ccb8ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/strokedb/document/associations.rb
Expand Up @@ -106,7 +106,9 @@ def has_many(slotname, opts={}, &block)
def initialize_associations
define_method(:_has_many_association) do |slotname, additional_query|
slot_has_many = meta["has_many_#{slotname}"]
result = slot_has_many.find(:key => self) # TODO: wrap it in LazyArray
result = LazyArray.new.load_with do |lazy_array|
slot_has_many.find(:key => self)
end
if extend_with = slot_has_many[:extend_with]
result.extend(extend_with.constantize)
end
Expand Down

0 comments on commit 5ccb8ae

Please sign in to comment.