From: Glen Holcomb Date: 2007-02-08T06:36:03+09:00 Subject: Re: Problems generating scaffolding ------=_Part_10638_21223168.1170884159172 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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 > ( > 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) -- "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) ------=_Part_10638_21223168.1170884159172--