Re: postgres adapater problem with create_table :id => false

Marnen Laibow-Koser
Thu, 17 Sep 2009 21:13:31 -0000

Howard Yeh wrote:
[...]
> The particular case is for a has_many association, but I want to avoid
> the overhead of having two indices.

That strikes me as a foolish premature optimization, rather like saying
that you don''t want headlights on your car because they take too much
power from the engine. :)

>
> It''ll be insertion only, so duplicate foreign key is acceptable.

Well, of course duplicate foreign keys would be acceptable.  But what do
you mean by "insertion only"?  Do you mean you''ll never be
reading from
the table?  If so, why have it?

>
> The association has the bag semantics.

I''m not familiar with that term.  What do you mean?

>
> If this doesn''t work, what''s "create_table :id =>
false"  ever used
> for?

For tables without AR models.  In a typical Rails app, that would only
be habtm join tables.

AR wants a primary key, and in any case, it''s poor practice not to have
one, even if it''s composite.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org

--
Posted via http://www.ruby-forum.com/.