Actually, I took a look at it again, and you are missing 'has
n, :items' in your User model. That solves the problem!

On Aug 4, 2:01 pm, Rip the Jacker <[email protected]> wrote:
> Yea I just checked it out and it's strange. It issues the same query
> as with User.get(1) but the resource never gets loaded. I'll look more
> into in when I get home.
>
> On Aug 3, 3:56 pm, Paul <[email protected]> wrote:
>
>
>
>
>
>
>
> > Here are the SQLs generated:
>
> > SELECT "id", "user_id" FROM "items" WHERE ("deleted_ts" IS NULL AND
> > "deleted" = 'f' AND "id" = 1) LIMIT 1
> > SELECT "id", "email" FROM "users" WHERE ("deleted_ts" IS NULL AND "id"
> > = 1 AND "deleted" = 'f') LIMIT 1
>
> > On Aug 3, 4:12 pm, Emmanuel Gomez <[email protected]> wrote:
>
> > > On Aug 3, 2011, at 12:18 PM, Paul wrote:
>
> > > > Here is an example:
>
> > > Thanks for the detailed example. If someone else doesn't get to it before 
> > > me, and we can't resolve it via email, I'll take a look at this today or 
> > > tomorrow.
>
> > > A couple of notes about your models, though I wouldn't expect these 
> > > things to affect the situation you describe here:
> > > 1) You shouldn't need to provide a default value to either 
> > > ParanoidBoolean (which defaults to false) or ParanoidDateTime (which 
> > > defaults to nil).
> > > 2) You should typically define relationships symmetrically—eg., add a 
> > > `has 1, :item` or `has n, :items` relationship definition to relate User 
> > > to Item. I've seen cases—all decidedly more complex than the scenario you 
> > > describe—where DM's inverse relationship inference fails and fails in 
> > > confusing ways.
>
> > > > Like I said before, this only happens if I use ParanoidBoolean.  If I
> > > > just use ParanoidDateTime, everything works fine.
>
> > > My first guess is that this is due to ParanoidBoolean and 
> > > ParanoidDateTime updating the default scope of the model to which they 
> > > are bound. However, the difference in behavior between the two challenges 
> > > that hypothesis.
>
> > > Can you furnish the SQL that is provided when you execute `item.user`?
>
> > > Thanks,
> > > Emmanuel

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

Reply via email to