Rufus Pollock wrote:

> [Repost from 5 days ago -- Google Groups is still rejecting email
> from my non-gmail account with which I subscribed (and doesn't send
> me mail either). My enquiry to the support team from 4 days ago is
> still unanswered and attempts to resubscribe have failed (i'm politely
> informed i'm already a member of the group ...).]

Yes, Rufus and I had a good off-list discussion, and I am glad he has
found a way to post (even if its not the preferred way).  I'll try and
get the conversation rolling again here.

> As I'd already been wondering whether I might be able to contribute
> the code into elixir as an extension, now that you already have
> something I'd very much like to:
>
> a) contribute/merge what I already have (if that would be useful).
>
> b) contribute to developing this feature (as part of elixiir) as it
> goes forward.

I advised Rufus that it would be best to work off of the versioning
support that I added to SVN a few weeks ago.  He agreed, and now we are
talking about how to version relationships.

One thing we both noted is that in order to version relationships, those
relationships need to be either:

     1. Stored as part of the main entity's table.  Or,
     2. Be a mapped object as well.

This brings me to an interesting point.  I think we sould deprecate
the current style of many-to-many relationships in favor of something
more powerful, that is more similar to the associable plugin.  Rails'
ActiveRecord has already done this, in favor of `has_many_through`,
which uses association objects.  Mike Bayer blogged a bit about the
concept here: http://techspot.zzzeek.org/?p=13.  I think we should try
and integrate these ideas directly into the core.  Here was one idea I
cooked up that might work:

It would be nice if the current `has_and_belongs_to_many` statement
would always generate an association object, but would hide it if
you didn't need it, or would let you add additional fields into the
relationship itself if you wanted that ability:

     class Person(Entity):
         has_field('name', Unicode)
         has_and_belongs_to_many(
             'addresses',
             of_kind='Address',
             with_attributes={
                 'address_type' : Unicode,
                 'address_name' : Unicode
             }
         )

     class Address(Entity):
         has_field('fulladdress', Unicode)

     p = Person.query().get(1)
     print p.addresses[0].address_type
     print p.addresses[0].address_name
     print p.addresses[0].target

     p.addresses.append(
         Person.addresses_association(
             address_type='Home',
             address_name='My Home Address',
             target=Address(fulladdress='123 Main St.')
         )
     )

Another alternative would be to do it more in the style of Rails, and
modify our `has_many` statement:

     http://wiki.rubyonrails.org/rails/pages/ThroughAssociations

Once the relationships themselves are mapped objects, it becomes easier
to version them using the existing `acts_as_versioned` Mapper Extension.

Any thoughts?

--
Jonathan LaCour
http://cleverdevil.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to