Problems generating scaffolding


#1

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)


#2

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 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)


#3

On 2/7/07, Glen H. 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 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


#4

Sorry not really thinking right now.

Will ask there.

On 2/7/07, Patrick H. 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)


#5

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 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


“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)