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')
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
--------------------------------
# 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.
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:49 pm, casual <kab...@gmail.com> wrote:
> Ok, I committed a fix (yet to be approved) to the current development:http://datamapper.lighthouseapp.com/projects/20609-datamapper/tickets...