# Problems Generating Scaffolding

**URL:** <https://www.ruby-forum.com/t/problems-generating-scaffolding/84819>\
**Category:** Rails\
**Created:** [February 7, 2007, 11:07pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84819 "2007-02-07T23:07:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 7, 2007, 11:07pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84819/1 "2007-02-07T23:07:52Z")

</div>

I am having trouble generating some of my scaffolding. I’m trying to  
use PostgreSQL as my back-end. Some of my scaffolding generates with  
no problem but for other parts I get this:

Before updating scaffolding from new DB schema, try creating a table  
for your model

The tables do exist. At least I can see them from psql.

Here is the SQL I’m using to create my tables:

CREATE TABLE dept  
(  
name character varying(20) NOT NULL,  
CONSTRAINT dept\_pkey PRIMARY KEY (name)  
)  
WITHOUT OIDS;

CREATE TABLE computer\_role  
(  
model character varying(15) NOT NULL,  
os character varying(10) NOT NULL,  
role integer NOT NULL,  
CONSTRAINT computer\_role\_pkey PRIMARY KEY (model, os, role)  
)  
WITHOUT OIDS;

CREATE TABLE computers  
(  
ram integer NOT NULL,  
model character varying(15) NOT NULL,  
cpu integer NOT NULL,  
cores integer NOT NULL DEFAULT 1,  
disk integer NOT NULL, – Space in Gigabytes  
census integer NOT NULL,  
CONSTRAINT computers\_pkey PRIMARY KEY (model, ram, disk)  
)  
WITHOUT OIDS;  
COMMENT ON COLUMN computers.disk IS ‘Space in Gigabytes’;

CREATE TABLE technicians  
(  
name character varying(40) NOT NULL,  
phone character(4) NOT NULL,  
department character varying(20) NOT NULL,  
email character varying(30) NOT NULL,  
CONSTRAINT technician\_pkey PRIMARY KEY (email)  
)  
WITHOUT OIDS;

CREATE TABLE sites  
(  
room character varying(8) NOT NULL,  
num\_machines integer NOT NULL,  
dept character varying(20) NOT NULL,  
software character varying(25)[] NOT NULL,  
machine\_types integer[] NOT NULL,  
machine\_type character varying(20)[] NOT NULL,  
CONSTRAINT sites\_pkey PRIMARY KEY (room),  
CONSTRAINT sites\_dept\_fkey FOREIGN KEY (dept)  
REFERENCES dept (name) MATCH SIMPLE  
ON UPDATE RESTRICT ON DELETE NO ACTION  
)  
WITHOUT OIDS;

CREATE TABLE free  
(  
name character varying(15) NOT NULL,  
publisher character varying(15),  
version character varying(8) NOT NULL,  
num\_copies integer NOT NULL,  
depts character varying(15)[] NOT NULL,  
CONSTRAINT free\_pkey PRIMARY KEY (name, version)  
)  
WITHOUT OIDS;

CREATE TABLE licensed  
(  
name character varying(30) NOT NULL,  
version character varying(10) NOT NULL,  
publisher character varying(15) NOT NULL,  
serial character varying(25) NOT NULL,  
lm boolean NOT NULL,  
license\_file text,  
licenses integer NOT NULL,  
num\_disks smallint NOT NULL DEFAULT 1,  
CONSTRAINT licensed\_pkey PRIMARY KEY (name, version, publisher)  
)  
WITHOUT OIDS;

I have no trouble with the scaffolding for sites, computers, and  
technicians but it throws up on the others.

Please forgive me if this is obvious. This is my first time trying to  
use rails. Any help would be greatly appreciated.

Thanks,  
Glen

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 7, 2007, 11:25pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84819/2 "2007-02-07T23:25:49Z")

</div>

all table names must be pluralized

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 7, 2007, 11:28pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84819/3 "2007-02-07T23:28:55Z")

</div>

Thank you!

Figured I was missing something obvious.

On Feb 7, 3:25 pm, Keynan P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 7, 2007, 11:28pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84819/4 "2007-02-07T23:28:55Z")

</div>

Thank you!

Figured I was missing something obvious.

On Feb 7, 3:25 pm, Keynan P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 7, 2007, 11:31pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84819/5 "2007-02-07T23:31:33Z")

</div>

your welcome

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 7, 2007, 11:31pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84819/6 "2007-02-07T23:31:52Z")

</div>

your welcome
