Displaying the id field

When the browser is pointed to http://localhost:3000/feeds there’s a
CRUD interface. However, the interface doesn’t display all of the
fields
defined at <http://strawr.googlecode.com/svn/trunk/db/
migrate/001_feeds.rb>.

I’ve done “rake db:migrate VERSION=0 ; rake db:migrate” and, also:

[email protected] ~/Desktop/strawr/db $
[email protected] ~/Desktop/strawr/db $ ll
total 20
-rw-r–r-- 1 thufir users 9216 Dec 8 04:29 development.sqlite3
drwxr-xr-x 3 thufir users 4096 Dec 8 04:29 migrate
-rw-r–r-- 1 thufir users 1430 Dec 8 04:29 schema.rb
[email protected] ~/Desktop/strawr/db $
[email protected] ~/Desktop/strawr/db $ sqlite3 development.sqlite3
SQLite version 3.4.1
Enter “.help” for instructions
sqlite> .schema
CREATE TABLE categories (“id” INTEGER PRIMARY KEY NOT NULL, “parent_num”
integer DEFAULT NULL, “title” varchar(255) DEFAULT NULL, “feed_id”
integer DEFAULT NULL);
CREATE TABLE feeds (“id” INTEGER PRIMARY KEY NOT NULL, “title” varchar
(255) DEFAULT NULL, “location” varchar(255) DEFAULT NULL, “category_id”
integer DEFAULT NULL, “item_id” integer DEFAULT NULL);
CREATE TABLE items (“id” INTEGER PRIMARY KEY NOT NULL, “title” varchar
(255) DEFAULT NULL, “is_read” integer DEFAULT NULL, “link” varchar(255)
DEFAULT NULL, “pub_date” varchar(255) DEFAULT NULL, “description”
varchar
(255) DEFAULT NULL, “feed_id” integer DEFAULT NULL);
CREATE TABLE nodes (“id” INTEGER PRIMARY KEY NOT NULL, “obj_num” integer
DEFAULT NULL, “norder” varchar(255) DEFAULT NULL, “type” varchar(255)
DEFAULT NULL);
CREATE TABLE posts (“id” INTEGER PRIMARY KEY NOT NULL, “post” varchar
(255) DEFAULT NULL);
CREATE TABLE schema_info (version integer);
sqlite>
sqlite> .quit
[email protected] ~/Desktop/strawr/db $
[email protected] ~/Desktop/strawr/db $

Clearly the “feeds” table has “item_id” as a field; so why doesn’t it
show in the CRUD? Perhaps I need to undo and then redo the
scaffolding?

based on <http://strawr.googlecode.com/svn/trunk/app/views/feeds/
show.rhtml>, I don’t see why all the fields for “feeds” aren’t being
displayed :frowning:

thanks,

Thufir

On 8 Dec 2007, at 12:41, Thufir wrote:

When the browser is pointed to http://localhost:3000/feeds there’s a
CRUD interface. However, the interface doesn’t display all of the
fields
defined at <http://strawr.googlecode.com/svn/trunk/db/
migrate/001_feeds.rb>.

Scaffolding just iterates over content_columns. If you look a the doc
for content_columns you’ll see that it doesn’t include columns ending
in _id

Fred

On Sat, 08 Dec 2007 13:09:05 +0000, Frederick C. wrote:

Scaffolding just iterates over content_columns. If you look a the doc
for content_columns you’ll see that it doesn’t include columns ending in
_id

Yes, you’re absolutely correct (I even looked at the API after posting
this last night). I tried a few variations, and did some light
googling,
but didn’t find a way to get it iterate over all fields.

Can I just change that one line so that it shows all of the fields when
doing any of the CRUD actions?

thanks,

Thufir

On 8 Dec 2007, at 19:33, Thufir wrote:

this last night). I tried a few variations, and did some light
googling,
but didn’t find a way to get it iterate over all fields.

Can I just change that one line so that it shows all of the fields
when
doing any of the CRUD actions?

does using Model.columns do what you want?

Fred

On Sat, 08 Dec 2007 19:57:04 +0000, Frederick C. wrote:

does using Model.columns do what you want?

I still get the same result after using Feed.columns :frowning:

http://strawr.googlecode.com/svn/trunk/app/views/feeds/list.rhtml

The database appears fine:

[email protected] ~/Desktop/strawr/db $
[email protected] ~/Desktop/strawr/db $
[email protected] ~/Desktop/strawr/db $
[email protected] ~/Desktop/strawr/db $ sqlite3 development.sqlite3
SQLite version 3.4.1
Enter “.help” for instructions
sqlite> .schema
CREATE TABLE categories (“id” INTEGER PRIMARY KEY NOT NULL, “parent_num”
integer DEFAULT NULL, “title” varchar(255) DEFAULT NULL, “feed_id”
integer DEFAULT NULL);
CREATE TABLE feeds (“id” INTEGER PRIMARY KEY NOT NULL, “title” varchar
(255) DEFAULT NULL, “location” varchar(255) DEFAULT NULL, “category_id”
integer DEFAULT NULL, “item_id” integer DEFAULT NULL);
CREATE TABLE items (“id” INTEGER PRIMARY KEY NOT NULL, “title” varchar
(255) DEFAULT NULL, “is_read” integer DEFAULT NULL, “link” varchar(255)
DEFAULT NULL, “pub_date” varchar(255) DEFAULT NULL, “description”
varchar
(255) DEFAULT NULL, “feed_id” integer DEFAULT NULL);
CREATE TABLE nodes (“id” INTEGER PRIMARY KEY NOT NULL, “obj_num” integer
DEFAULT NULL, “norder” varchar(255) DEFAULT NULL, “type” varchar(255)
DEFAULT NULL);
CREATE TABLE posts (“id” INTEGER PRIMARY KEY NOT NULL, “post” varchar
(255) DEFAULT NULL);
CREATE TABLE schema_info (version integer);
sqlite>
sqlite> .quit
[email protected] ~/Desktop/strawr/db $

-Thufir

On Sun, 09 Dec 2007 11:04:01 +0000, Frederick C. wrote:

Well you’ve still got a content_columns at the top of your page. Other
than that I don’t see why it wouldn’t work (although you wouldn’t see
anything if the _id columns were null)

Doh, fixed that; thanks. The item_id field for a row in the feeds table
will be null until I can edit that field; for instance, by displaying
the
field.

Won’t it show: “item_id: NULL” as it does for other fields?

thanks,

Thufir

On 9 Dec 2007, at 07:02, Thufir wrote:

On Sat, 08 Dec 2007 19:57:04 +0000, Frederick C. wrote:

does using Model.columns do what you want?

I still get the same result after using Feed.columns :frowning:

http://strawr.googlecode.com/svn/trunk/app/views/feeds/list.rhtml

Well you’ve still got a content_columns at the top of your page. Other
than that I don’t see why it wouldn’t work (although you wouldn’t see
anything if the _id columns were null)

Fred

On 10 Dec 2007, at 09:36, Thufir wrote:

will be null until I can edit that field; for instance, by
displaying the
field.

Won’t it show: “item_id: NULL” as it does for other fields?

no. It would show nil.to_s (ie blank), although you should of course
get the column headings.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs