Thanks for the advice Russel. For the stuff I do (simple things to blog
about), it's probably not an issue, but I'll keep it in mind if I need to do
any "real" work.

Scott

On Wed, Aug 18, 2010 at 6:00 PM, russm <[email protected]> wrote:

> On Aug 19, 12:09 am, Jeremy Evans <[email protected]> wrote:
>
> > You don't need a primary key in the join table, and since you just
> > care about the returned primary key, you save the values for the
> > inserts into the main model table, and do your own insert into the
> > join table.
>
> while you don't need one, personally I like to use a composite PK for
> join tables to protect against inadvertently inserting multiple
> identical associations.
>
> create_table(:authors_books) do
>  foreign_key :author_id, :authors
>  foreign_key :book_id, :books
>   primary_key [:author_id, :book_id]
> end
>
> (and since the join table will probably end up needing to be indexed
> anyway, the PK unique index gives you one of those for free)
>
>
> cheers
>
> Russell
>
> --
> 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]<sequel-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/sequel-talk?hl=en.
>
>


-- 
Scott
http://steamcode.blogspot.com/

-- 
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