# Problems generating scaffolding

**URL:** <https://www.ruby-forum.com/t/problems-generating-scaffolding/84814>\
**Category:** Ruby\
**Created:** [February 7, 2007, 10:34pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84814 "2007-02-07T22:34:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [February 7, 2007, 10:34pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84814/1 "2007-02-07T22:34:47Z")

</div>

Hello,

I’m trying to write a rails application using Postgres for my back-end.  
When I go to generate the scaffolding some of them work and some of them  
don’t. I’m not sure why some are failing. According to Postgres all  
the  
tables exist yet rails only seems to find some of them.

Here is the SQL I’m using to generate the 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;

It has no trouble with sites, computers or technicians but doesn’t like  
the  
others at all.

Any help would be appreciated.

–  
“Hey brother christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [February 7, 2007, 10:36pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84814/2 "2007-02-07T22:36:48Z")

</div>

Sorry I forgot the error I’m getting

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

On 2/7/07, Glen H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> CREATE TABLE dept  
> os character varying(10) NOT NULL,  
> cpu integer NOT NULL,  
> (  
> (  
> )  
> CONSTRAINT free\_pkey PRIMARY KEY (name, version)  
> lm boolean NOT NULL,  
> Any help would be appreciated.
> 
> –  
> “Hey brother christian with your high and mighty errand, Your actions  
> speak so loud, I can’t hear a word you’re saying.”
> 
> -Greg Graffin (Bad Religion)

–  
“Hey brother christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [February 7, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84814/3 "2007-02-07T22:47:48Z")

</div>

On 2/7/07, Glen H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > I’m trying to write a rails application using Postgres for my back-end.

Not trying to be rude, but rails specific questions are best handled  
on Rails specific forums (see [Ruby on Rails — Community](http://rubyonrails.org/community)) or you  
may want to try a local user group where the message volume is not so  
high.

Good luck  
pth

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [February 7, 2007, 10:51pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84814/4 "2007-02-07T22:51:49Z")

</div>

Sorry not really thinking right now.

Will ask there.

On 2/7/07, Patrick H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Good luck  
> pth

–  
“Hey brother christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

---

<div class="post-metadata">

**Author:** ![Glen\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Post date:** [September 25, 2007, 11:01pm UTC](https://www.ruby-forum.com/t/problems-generating-scaffolding/84814/5 "2007-09-25T23:01:10Z")

</div>

My apologies. I should read more. I was directed here and didn’t think  
twice about it.

On 2/7/07, Kevin C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > use PostgreSQL as my back-end. Some of my scaffolding generates with  
> > CREATE TABLE dept  
> > os character varying(10) NOT NULL,  
> > cpu integer NOT NULL,  
> > (  
> > (  
> > )  
> > CONSTRAINT free\_pkey PRIMARY KEY (name, version)  
> > lm boolean NOT NULL,  
> > Please forgive me if this is obvious. This is my first time trying to  
> > –  
> > Kevin C.  
> > [http://glu.ttono.us](http://glu.ttono.us)
> 
> >

–  
“Hey brother christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)
