Hey Richard,

This sounds like trouble. Serial is used as the identifier in identity map 
so lazy loading it doesn't sound like a good idea.

Cheers

# solnic

On Saturday, December 8, 2012 5:56:18 PM UTC+1, Richard Fairhurst wrote:
>
> Hi, 
>
> I'm building a model where I'd like _all_ the properties, including 
> the primary key, to be lazy-loaded. Like this: 
>
> class Post 
>         include DataMapper::Resource 
>
>         property :id, Serial, :lazy => [ :show ] 
>         property :title, String, :lazy => [ :show ] 
>         property :body, Text, :lazy => [ :show ] 
>         property :created_at, DateTime, :lazy => [ :show ] 
> [...] 
>
> However, when I try to get an instance, the result is this: 
>
>         post=Post.get(1) 
>  ~ (0.000379) SELECT `id` FROM `posts` WHERE `id` = 1 LIMIT 1 
>
> Is there any way of eliminating this database query? I'm presuming 
> DataMapper does it because it wants to validate that the record 
> exists, but if possible, I'd rather take that chance and skip the 
> query. 
>
> cheers 
> Richard 
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/datamapper/-/km6eIP1226cJ.
To post to this group, send email to datamapper@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