lib/praxis-blueprints/collection_view.rb in praxis-blueprints-3.1 vs lib/praxis-blueprints/collection_view.rb in praxis-blueprints-3.2
- old
+ new
@@ -3,11 +3,19 @@
class CollectionView < View
def initialize(name, schema, member_view=nil)
super(name,schema)
if member_view
- @contents = member_view.contents.clone
+ @_lazy_view = member_view
end
+ end
+
+ def contents
+ if @_lazy_view
+ @contents = @_lazy_view.contents.clone
+ @_lazy_view = nil
+ end
+ super
end
def example(context=Attributor::DEFAULT_ROOT_CONTEXT)
collection = 3.times.collect do |i|
subcontext = context + ["at(#{i})"]