# Scaffold leaving out column names ending in \_id?

**URL:** <https://www.ruby-forum.com/t/scaffold-leaving-out-column-names-ending-in-id/121769>\
**Category:** Rails\
**Created:** [November 30, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/scaffold-leaving-out-column-names-ending-in-id/121769 "2007-11-30T19:25:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 30, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/scaffold-leaving-out-column-names-ending-in-id/121769/1 "2007-11-30T19:25:35Z")

</div>

I’ve been trying to get scaffold to display all fields in a simple  
table.  
I noticed that if a column name ends in ‘\_id’ the scaffold ignores it,  
also the scaffold does not display the primary key, named ‘id’.  
Where can I find a list of the rules that the scaffold follows?  
If they are simply the rails rules, please provide that link.

Thanks!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 1, 2007, 12:07am UTC](https://www.ruby-forum.com/t/scaffold-leaving-out-column-names-ending-in-id/121769/2 "2007-12-01T00:07:29Z")

</div>

Hi,

I think the scaffold uses (or at least used to use) this function to  
create the list of fields:

> **[ActiveRecord::Base](https://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001033)**
>
> Active Record Active Record objects don't specify their attributes directly, but rather infer them from the table definition with which they're linked.

Allan

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 1, 2007, 1:16am UTC](https://www.ruby-forum.com/t/scaffold-leaving-out-column-names-ending-in-id/121769/3 "2007-12-01T01:16:22Z")

</div>

Allan wrote:

> Hi,
> 
> I think the scaffold uses (or at least used to use) this function to  
> create the list of fields:
> 
> [http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001033](http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001033)
> 
> Allan

in your database design, under ROR, the foreign key is \_id,  
and is ignored in scaffolding … but you can add it by hand. easy to  
do.

if i got this wrong, fred made me do it.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 1, 2007, 4:05am UTC](https://www.ruby-forum.com/t/scaffold-leaving-out-column-names-ending-in-id/121769/4 "2007-12-01T04:05:33Z")

</div>

It’s pretty pointless for scaffolding to include these anyway. You’re  
going  
to have the id in the URL (for edit pages), you’re going to need to  
build a  
picklist for your \_id fields because Rails, when you scaffold, can’t  
know  
what you’re trying to do.

Scaffolding is a learning tool. It was not, and never will be, intended  
for  
actual use in a production application.

Other projects, like ActiveScaffold and Streamlined, do offer very  
robust  
automatic interface builders.
