I am new to Datamapper. I have written a Rails application in which I have 
used three models A, B and C.

*   class A
      include DataMapper::Resource
      property :id, Serial
      has n, :cs, :through => Resource
    class C
      include DataMapper::Resource
      property :id, Serial
      has n, :c_as
      has n, :as, :through => :c_as

    class B
      include DataMapper::Resource
      belongs_to :a, :required => true
      belongs_to :c, :required => true

Now as part of index action of my as_controller in *index.html.haml* I have 
used the following codes:

    *-a.c.each do |c|
In this *a.c.each *lazy loading happen, so in each iteration unnecessarily 
the statement *a.c* is being evaluated that takes too much time, even if I 
same *a.c* to a third temporary object like *b = a.c * and use *b.each*then 
also lazy loading happens on this line only. Is there any way to avoid 
that so that the statement is evaluated only once just before this block?

You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to datamapper+unsubscr...@googlegroups.com.
To post to this group, send email to datamapper@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to