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

Rick
Sat, 19 Sep 2009 11:42:24 -0000

Rails doesn''t insist - it''s only Marnen.

On Sep 17, 7:42 pm, Howard Yeh
<hay...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> On Sep 17, 2:13 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas-
>
>
>
> s.net> wrote:
> > 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?
>
> It just means under a key there can be many items. That''s exactly
what
> I want, and it seems silly to have a primary key I don''t use. But
> nevermind that, if rails insists, so be it.
>
>
>
> > > 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-Koserhttp://www.marnen.org
> > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org
>
> > --
> > Posted viahttp://www.ruby-forum.com/.