Forum: Ruby on Rails Using primary key that is not named "id"

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.
15c43b9d84557e8547eea759ee3ba016?d=identicon&s=25 Victor Fan (victorfan)
on 2006-05-12 22:50
Hi

I am using a legacy database that the primary key is named "ProductID"
and its type is SERIAL (or INT NOT NULL auto_increment).

set_primary_key "ProductID", is added to the Product class

Then I used >ruby script/generate scaffold Product Admin
to generate my controllers.  When I try to insert a new product in the
products table, it gave me this error

RuntimeError: ERROR	C42P01	Mrelation "product_productid_seq" does not
exist	Fnamespace.c	L195	RRangeVarGetRelid: SELECT
currval('Product_ProductID_seq')

What does this mean and is what can I do to solve this?

Thank you!
This topic is locked and can not be replied to.