Ok, I committed a fix (yet to be approved) to the current development:
http://datamapper.lighthouseapp.com/projects/20609-datamapper/tickets/1197-lazy-contexts-gone-again#ticket-1197-2


And to help you in the meantime, I applied that fix as a patch to
0.10.2: http://github.com/kabari/dm-core/tree/10_2_patch, just clone
it and sudo rake install, that should help you out until the next
release :)

On Feb 12, 6:37 pm, casual <kab...@gmail.com> wrote:
> I believe this is a bug, I just wrote a test for it in the current dm-
> core and it fails:
>
> --------------------------------
> # in resource_shared_spec/ describe 'lazy loading'
>
>     describe "with context" do
>       before(:all) do
>         rescue_if @skip do
>           comment = @comment_model.create(:body => 'I really like your
> Def Jux baby tee.', :url => 'http://blog.foo.com', :gravatar_url =>
> 'http://gravatar.com/image.png', :user => @user)
>
>           @comment = @comment_model.get(*comment.key)
>         end
>       end
>
>       it "should not fetch the lazy keys" do
>         @comment_model.properties[:url].loaded?(@comment).should_not
> be(true)
>         @comment_model.properties[:gravatar_url].loaded?
> (@comment).should_not be(true)
>       end
>
>       it "should fetch all lazy kys in the context" do
>         @comment.url
>         @comment_model.properties[:url].loaded?(@comment).should
> be(true)
>         @comment_model.properties[:gravatar_url].loaded?
> (@comment).should be(true) # => fails a returning false
>       end
>     end
> -----------------------------
>
> I will take a look at the lighthouse project and see if there is a
> ticket for this already, if not I'll file one.
>
> On Feb 11, 6:00 pm, daniel_spaniel <geu...@gmail.com> wrote:
>
>
>
> > Hi
> >  I am following the documentation about lazy loading properties. I
> > especially liked the concept of grouping the lazy loading properties
> > together. So I tried it. But when I look at the sql it does not really
> > happen as expected.
>
> > DataMapper.setup(:default, 'sqlite3://:memory:')
>
> > class Post
> >   include DataMapper::Resource
>
> >   property :id,       Serial
> >   property :name,     String,   :lazy => [:show]
> >   property :volume,   Integer,  :lazy => [:show]
> >   property :idea,     String,   :lazy => [:report]
>
> > end
>
> > Post.auto_migrate!
> > Post.create(:name=>'Dan',:volume=>5,:idea=>'moo')
>
> > Post.first.name
>
> > When I look at query for ( Post.first.name ) I see only the name
> > property loaded, not the name and volume together which I thought was
> > supposed to happen since they are in the same lazy :show group.
> >  Am I doing something wrong?
>
> > ~ Dan

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamap...@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to