the behavior is pretty strange.
belongs_to :shell_user, :class_name => User, :child_key =>
[:shell_user_id]
gets me close, but my property requires more detail:
I would want:
belongs_to :shell_user, :class_name => User, :child_key =>
[:friend_id], :nullable => false, :index => true
But that doesn't work. Other variations I've guessed at don't work
either. Also, this thing called child_key seems odd. why is it an
array? also, since child_key ends up being the name of my field, why
doesn't this work:
belongs_to :shadow_user, {:class_name => User, :field =>
'shadow_user_id', :nullable => false, :index => true}
That seems to be more consistant across other property declarations.
Am I still missing something aside from the fact that the guy that
invented rails saddled the ruby word with nomenclature that bucks
against 30 years of relational data modeling? Basic data modeling
tells me that my relation is a "has 1" not a "belongs to"
thanks, Jon
On Dec 22, 4:32 am, "Dirkjan Bussink" <[email protected]> wrote:
> On Sun, Dec 21, 2008 at 9:24 PM, Jon Hancock <[email protected]> wrote:
> > So now, I'm back to the way I had it before. I have a property for
> > the id and I hand code accessors to look up the user by this id. I
> > thought what I was trying to do should be the simplest form of a
> > datamapper association.
>
> Why don't you use a belongs_to relation if you don't mind me asking?
> Because belongs_to does exactly what you need: "This I assumed would
> give the object/table a property/field of
> shell_user_id and an association to get/set the object with the
> shell_user accessors."
>
> --
> Regards,
>
> Dirkjan Bussink
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---