Create/new on tables without sequences?


#1

I have a table as such:

table1_id|table2_id

No id, primary key, sequence, etc. When I try to
create/new a record, I get this:

table21.create(:table1_id=>1, :table2_id=>2)

PGError: ERROR: relation “table12_id_seq” does not
exist
: SELECT currval(‘table12_id_seq’)

Does Rails really expect all tables to have id
sequences, or is there a way around this?

thanks
csn


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


#2

CSN,

Is there a reason you actively don’t want to have a primary key in
your join tables? Even in cases where you only expect a one to one
relationship (example: husband to wife) it doesn’t hurt to have a
primary key, and if your assumptions don’t hold true (say you take on
some polygamous users) you’ll have a mess to clean up.

pt.

On 12/11/05, CSN removed_email_address@domain.invalid wrote:

exist
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Parker T.
http://www.parkert.com/
510.541.0125


#3

A mess? Dealing with join table data is pretty simple.
Primary keys for them are useless IMO.

My last two questions are moot - HABTM is pretty
slick. Got everything working :).

csn

— Parker T. removed_email_address@domain.invalid wrote:

some polygamous users) you’ll have a mess to clean

No id, primary key, sequence, etc. When I try to
sequences, or is there a way around this?
Rails mailing list


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


#4

Dear Sir,

I’ve got the same troubles as you on creating new records on tables
without sequences.
Could you, please, tell me that is the solution that you’ve found?
Thank you in advance.

ag

CSN wrote:

Got everything working :).

csn