I just pushed a few commits that enable composite key support for
associations.   Now, all 3 default association types support composite
keys for their getters/setters/add_/remove_/remove_all_ methods, as
well as for eager loading via both eager and eager_graph.

Using the new composite key feature is pretty simple.  The :key
and :primary_key options for many_to_one and one_to_many associations
and the :left_key, :left_primary_key, :right_key,
and :right_primary_key options for many_to_many associations now take
arrays of symbols in addition to a single symbol:

  Artist.set_primary_key [:name, :location]
  Album.set_primary_key [:artist_name, :album_name]
  Track.set_primary_key [:artist_name, :album_name, :number]
  Album.many_to_one :artist, :key=>[:artist_name, :artist_location]
  Artist.one_to_many :albums, :key=>[:artist_name, :artist_location]
  Artist.many_to_many :tracks, :left_key=>
[:artist_name, :artist_location],
     :right_key=>[:artist_name, :album_name],
     :right_primary_key=>[:artist_name, :album_name]

If you are currently using custom associations to handle composite
keys, try using the new native composite key support and let me know
how it works for you.

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

Reply via email to