Forum: Ruby on Rails create/new on tables without sequences?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 CSN (Guest)
on 2005-12-12 04:27
(Received via mailing list)
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
19c9af375aca3001e3978cb16684803c?d=identicon&s=25 Parker Thompson (Guest)
on 2005-12-12 06:12
(Received via mailing list)
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 <cool_screen_name90001@yahoo.com> wrote:
> exist
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Parker Thompson
http://www.parkert.com/
510.541.0125
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 CSN (Guest)
on 2005-12-12 07:06
(Received via mailing list)
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 Thompson <parkert@gmail.com> 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
> Rails@lists.rubyonrails.org
> 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
498c5b4e0507a3388f07ea20f7230ab8?d=identicon&s=25 Artem Golubev (artem)
on 2007-10-04 13:01
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
This topic is locked and can not be replied to.