Thanks for the help Martin. Your fix worked, and it also allowed me to
isolate the problem with the mess of a script I pasted before :-).

Apparently :child_key is what was causing the problem. Removing that
from the has n relationship fixed things:
http://gist.github.com/192733

Is :child_key broken on 0.10, or was I just using it wrong? Seems like
this should be valid syntax for the through relationship (though
redundant):

class User
  include DataMapper::Resource

  property :id,           Serial

  has n, :group_memberships
  has n, :groups, :through => :group_memberships,  :via
=> :group, :child_key => [:group_id]
end





On Sep 24, 5:44 am, Martin Gamsjaeger <[email protected]> wrote:
> Jacques,
>
> Have a look athttp://pastie.org/628860
> Is this what you would expect?
>
> cheers
> snusnu
>
>
>
> On Thu, Sep 24, 2009 at 14:17, Jacques Crocker <[email protected]> wrote:
>
> > Hi. I'm seeing an error in my "has n through" relationship when
> > migrating from dm-core 0.9.10 to 0.10. Please let me know if I'm
> > writing the syntax wrong.
>
> > Here's the model:
>
> >  class User
> >    include DataMapper::Resource
> >    property :id, Serial
> >    has n, :group_memberships
> >    has n, :groups, :through => :group_memberships, :model =>
> > "Group", :via => :group, :parent_key => [:id], :child_key =>
> > [:user_id]
> >  end
>
> > It produces this error when I use User.auto_migrate!
>
> >  NoMethodError: undefined method ‘name’ for nil:NilClass
> >  method initialize     in property_set.rb at line 169
>
> > Here's a couple scripts that should easily allow you to reproduce the
> > error:
>
> > This script works in 0.9.10:
> >http://gist.github.com/192686
>
> > This same script breaks in 0.10.0:
> >http://gist.github.com/192682
--~--~---------~--~----~------------~-------~--~----~
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