DM Constraints and anonymous resources

3 views
Skip to first unread message

codaniel

unread,
Feb 11, 2009, 1:12:04 AM2/11/09
to DataMapper
Ive been working with dm constraints over the past few days. Ive got
them working now, except with anonymous relationships . . . is anyone
using dm-constraings with :through => Resource...

I found the source of 'the problem' unless Im misusing them . . . it
seems that when you have a many to many relationship through an
anonymous resource model.many_to_one_relationships doesn't return the
relationship to that anonymous resource (by design?), but this is how
dm-constraints adds constraints...

I wanted to take a crack at fixing it, but i wasn't sure if it was a
bug in dm-core, or if dm-constraints should do a pass through
many_to_many_relationships and see if it is through an anonymous
resource. Thoughts?

Dan Kubb (dkubb)

unread,
Feb 11, 2009, 2:41:50 AM2/11/09
to DataMapper
codaniel,

> I found the source of 'the problem' unless Im misusing them . . . it
> seems that when you have a many to many relationship through an
> anonymous resource model.many_to_one_relationships doesn't return the
> relationship to that anonymous resource (by design?), but this is how
> dm-constraints adds constraints...
>
> I wanted to take a crack at fixing it, but i wasn't sure if it was a
> bug in dm-core, or if dm-constraints should do a pass through
> many_to_many_relationships and see if it is through an anonymous
> resource.  Thoughts?

You might want to check out many to many associations in the "next"
branch. I began to implement things differently than it was done in
the master branch. I'd say I'm still only about 40-50% of the way
done, but the basic ideas are there. You should be able to access the
anonymous resource using the relationship objects.

--

Dan

codaniel

unread,
Feb 11, 2009, 1:29:55 PM2/11/09
to DataMapper
Cool will do. I'm not sure Im ready to roll next in production
though. So i'll work on a solution for the current version in the
meantime for the stable version of dm.

Dan Kubb (dkubb)

unread,
Feb 11, 2009, 2:14:26 PM2/11/09
to DataMapper
codaniel,

> Cool will do.  I'm not sure Im ready to roll next in production
> though.  So i'll work on a solution for the current version in the
> meantime for the stable version of dm.

Aside from two things, next is far more stable than master. The two
issues are getting many to many code stabilized, and adding SEL back
in. I tore out SEL because I wasn't happy with how it was working,
and I didn't want it to interfere while I was rewriting associations.

--

Dan
(dkubb)

codaniel

unread,
Feb 17, 2009, 2:10:46 PM2/17/09
to DataMapper
If anyone is interested, I did a bunch of work to dm-constraints,
added 1:1 and M:M support + documentation:
http://github.com/coryodaniel/dm-more
Reply all
Reply to author
Forward
0 new messages