# Problems generating scaffolding

**URL:** <https://rubytalk.org/t/problems-generating-scaffolding/35164>\
**Category:** ruby-talk\
**Created:** [7 February 2007 21:34 UTC](https://rubytalk.org/t/problems-generating-scaffolding/35164 "2007-02-07T21:34:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glen\_Holcomb](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Glen\_Holcomb](https://rubytalk.org/u/Glen_Holcomb)\
**Post date:** [7 February 2007 21:34 UTC](https://rubytalk.org/t/problems-generating-scaffolding/35164/1 "2007-02-07T21:34:28Z")

</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  
(  
&nbsp;&nbsp;name character varying(20) NOT NULL,  
&nbsp;&nbsp;CONSTRAINT dept\_pkey PRIMARY KEY (name)  
)  
WITHOUT OIDS;

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

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

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

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

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

CREATE TABLE licensed  
(  
&nbsp;&nbsp;name character varying(30) NOT NULL,  
&nbsp;&nbsp;version character varying(10) NOT NULL,  
&nbsp;&nbsp;publisher character varying(15) NOT NULL,  
&nbsp;&nbsp;serial character varying(25) NOT NULL,  
&nbsp;&nbsp;lm boolean NOT NULL,  
&nbsp;&nbsp;license\_file text,  
&nbsp;&nbsp;licenses integer NOT NULL,  
&nbsp;&nbsp;num\_disks smallint NOT NULL DEFAULT 1,  
&nbsp;&nbsp;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\_Holcomb](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Glen\_Holcomb](https://rubytalk.org/u/Glen_Holcomb)\
**Post date:** [7 February 2007 21:36 UTC](https://rubytalk.org/t/problems-generating-scaffolding/35164/2 "2007-02-07T21:36:03Z")

</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 Holcomb \<damnbigman@gmail.com\> wrote:
> 
> > 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  
> > (  
> > &nbsp;&nbsp;name character varying(20) NOT NULL,  
> > &nbsp;&nbsp;CONSTRAINT dept\_pkey PRIMARY KEY (name)  
> > )  
> > WITHOUT OIDS;
> > 
> > CREATE TABLE computer\_role  
> > (  
> > &nbsp;&nbsp;model character varying(15) NOT NULL,  
> > &nbsp;&nbsp;os character varying(10) NOT NULL,  
> > &nbsp;&nbsp;role integer NOT NULL,  
> > &nbsp;&nbsp;CONSTRAINT computer\_role\_pkey PRIMARY KEY (model, os, role)  
> > )  
> > WITHOUT OIDS;
> > 
> > CREATE TABLE computers  
> > (  
> > &nbsp;&nbsp;ram integer NOT NULL,  
> > &nbsp;&nbsp;model character varying(15) NOT NULL,  
> > &nbsp;&nbsp;cpu integer NOT NULL,  
> > &nbsp;&nbsp;cores integer NOT NULL DEFAULT 1,  
> > &nbsp;&nbsp;disk integer NOT NULL, -- Space in Gigabytes  
> > &nbsp;&nbsp;census integer NOT NULL,  
> > &nbsp;&nbsp;CONSTRAINT computers\_pkey PRIMARY KEY (model, ram, disk)  
> > )  
> > WITHOUT OIDS;  
> > COMMENT ON COLUMN computers.disk IS 'Space in Gigabytes';
> > 
> > CREATE TABLE technicians  
> > (  
> > &nbsp;&nbsp;name character varying(40) NOT NULL,  
> > &nbsp;&nbsp;phone character(4) NOT NULL,  
> > &nbsp;&nbsp;department character varying(20) NOT NULL,  
> > &nbsp;&nbsp;email character varying(30) NOT NULL,  
> > &nbsp;&nbsp;CONSTRAINT technician\_pkey PRIMARY KEY (email)  
> > )  
> > WITHOUT OIDS;
> > 
> > CREATE TABLE sites  
> > (  
> > &nbsp;&nbsp;room character varying(8) NOT NULL,  
> > &nbsp;&nbsp;num\_machines integer NOT NULL,  
> > &nbsp;&nbsp;dept character varying(20) NOT NULL,  
> > &nbsp;&nbsp;software character varying(25) NOT NULL,  
> > &nbsp;&nbsp;machine\_types integer NOT NULL,  
> > &nbsp;&nbsp;machine\_type character varying(20) NOT NULL,  
> > &nbsp;&nbsp;CONSTRAINT sites\_pkey PRIMARY KEY (room),  
> > &nbsp;&nbsp;CONSTRAINT sites\_dept\_fkey FOREIGN KEY (dept)  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REFERENCES dept (name) MATCH SIMPLE  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ON UPDATE RESTRICT ON DELETE NO ACTION  
> > )  
> > WITHOUT OIDS;
> > 
> > CREATE TABLE free  
> > (  
> > &nbsp;&nbsp;name character varying(15) NOT NULL,  
> > &nbsp;&nbsp;publisher character varying(15),  
> > &nbsp;&nbsp;version character varying(8) NOT NULL,  
> > &nbsp;&nbsp;num\_copies integer NOT NULL,  
> > &nbsp;&nbsp;depts character varying(15) NOT NULL,  
> > &nbsp;&nbsp;CONSTRAINT free\_pkey PRIMARY KEY (name, version)  
> > )  
> > WITHOUT OIDS;
> > 
> > CREATE TABLE licensed  
> > (  
> > &nbsp;&nbsp;name character varying(30) NOT NULL,  
> > &nbsp;&nbsp;version character varying(10) NOT NULL,  
> > &nbsp;&nbsp;publisher character varying(15) NOT NULL,  
> > &nbsp;&nbsp;serial character varying(25) NOT NULL,  
> > &nbsp;&nbsp;lm boolean NOT NULL,  
> > &nbsp;&nbsp;license\_file text,  
> > &nbsp;&nbsp;licenses integer NOT NULL,  
> > &nbsp;&nbsp;num\_disks smallint NOT NULL DEFAULT 1,  
> > &nbsp;&nbsp;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)
> 
> --  
> "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:** ![Patrick\_Hurley1](https://avatars.discourse-cdn.com/v4/letter/p/b77776/32.png) [@Patrick\_Hurley1](https://rubytalk.org/u/Patrick_Hurley1)\
**Post date:** [7 February 2007 21:47 UTC](https://rubytalk.org/t/problems-generating-scaffolding/35164/3 "2007-02-07T21:47:20Z")

</div>

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

Good luck  
pth

> **···**
>
> On 2/7/07, Glen Holcomb \<damnbigman@gmail.com\> wrote:
> 
> > \> I'm trying to write a rails application using Postgres for my back-end.

---

<div class="post-metadata">

**Author:** ![Glen\_Holcomb](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Glen\_Holcomb](https://rubytalk.org/u/Glen_Holcomb)\
**Post date:** [7 February 2007 21:51 UTC](https://rubytalk.org/t/problems-generating-scaffolding/35164/4 "2007-02-07T21:51:01Z")

</div>

Sorry not really thinking right now.

Will ask there.

> **···**
>
> On 2/7/07, Patrick Hurley \<phurley@gmail.com\> wrote:
> 
> > On 2/7/07, Glen Holcomb \<damnbigman@gmail.com\> 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 [http://rubyonrails.org/community\](http://rubyonrails.org/community%5C)) or you  
> > may want to try a local user group where the message volume is not so  
> > high.
> > 
> > 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)
