Compose_primary_keys

I´m looking for a way to work with compose primary keys.
I alredy know that plugin http://compositekeys.rubyforge.org/
but it doesn´t have examples.

Please help =]


Horus Augustus C. C. Lima

Sagarana Tech
Mobile +55(85)8842.4402
Desk +55(85)3304.6530
[email protected]
http://www.sagaranatech.com

Augustus C. wrote:

I´m looking for a way to work with compose primary keys.
I alredy know that plugin http://compositekeys.rubyforge.org/
but it doesn´t have examples.
What do you mean it doesn’t have examples? What is this:

class Membership < ActiveRecord::Base

set_primary_keys *keys - turns on composite key functionality

set_primary_keys :user_id, :group_id
belongs_to :user
belongs_to :group
has_many :statuses, :class_name => ‘MembershipStatus’, :foreign_key =>
[:user_id, :group_id]
end

there’s a Google group “Composite Keys for ActiveRecord” that you
might look at for tips