# Why does scaffold ignores some fields?

**URL:** <https://www.ruby-forum.com/t/why-does-scaffold-ignores-some-fields/104666>\
**Category:** Rails\
**Created:** [May 21, 2007, 12:35pm UTC](https://www.ruby-forum.com/t/why-does-scaffold-ignores-some-fields/104666 "2007-05-21T12:35:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gioele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8491ac/32.png) [@gioele](https://www.ruby-forum.com/u/gioele)\
**Post date:** [May 21, 2007, 12:35pm UTC](https://www.ruby-forum.com/t/why-does-scaffold-ignores-some-fields/104666/1 "2007-05-21T12:35:14Z")

</div>

Hello,

somehow the ‘scaffold’ method does not emits HTML fields for all the  
fields  
of my models. For example, this simple controller:

class CatalogController \< ApplicationController  
scaffold :fact  
end

and a model backed by (sqlite3, tested also with mysql)

create table “facts” (  
“id” integer primary key autoincrement,  
“type” varchar not null,  
“device\_id” integer not null,  
“stated\_on” date not null,  
“created\_at” datetime not null,  
“updated\_at” datetime not null,  
“approved” boolean default false  
);

produces HTML fields only for “Stated on”, “Created at”, “Updated at”  
and “Approved”. “type” and “device\_id” are ignored. Why?

---

<div class="post-metadata">

**Author:** ![gioele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8491ac/32.png) [@gioele](https://www.ruby-forum.com/u/gioele)\
**Post date:** [May 21, 2007, 2:00pm UTC](https://www.ruby-forum.com/t/why-does-scaffold-ignores-some-fields/104666/2 "2007-05-21T14:00:10Z")

</div>

Simple.

type is a “reserved word” in Ruby. Not really a reserved word like in  
other language but a synonym for the Object.class method. Since  
everything an object in Ruby…

deviced\_id is maybe ignored because it is a foreign key. If you want to  
display the linked records, you should do it by yourself by customizing  
the scaffold and use select or collection\_select.

Nicolas.

Gioele wrote:

> Hello,
> 
> somehow the ‘scaffold’ method does not emits HTML fields for all the  
> fields  
> of my models. For example, this simple controller:
> 
> class CatalogController \< ApplicationController  
> scaffold :fact  
> end
> 
> and a model backed by (sqlite3, tested also with mysql)
> 
> create table “facts” (  
> “id” integer primary key autoincrement,  
> “type” varchar not null,  
> “device\_id” integer not null,  
> “stated\_on” date not null,  
> “created\_at” datetime not null,  
> “updated\_at” datetime not null,  
> “approved” boolean default false  
> );
> 
> produces HTML fields only for “Stated on”, “Created at”, “Updated at”  
> and “Approved”. “type” and “device\_id” are ignored. Why?
