# Where are all my fields?

**URL:** <https://www.ruby-forum.com/t/where-are-all-my-fields/125172>\
**Category:** Rails\
**Created:** [January 6, 2008, 5:04pm UTC](https://www.ruby-forum.com/t/where-are-all-my-fields/125172 "2008-01-06T17:04:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvazquez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/858c86/32.png) [@jvazquez](https://www.ruby-forum.com/u/jvazquez)\
**Post date:** [January 6, 2008, 5:04pm UTC](https://www.ruby-forum.com/t/where-are-all-my-fields/125172/1 "2008-01-06T17:04:51Z")

</div>

I am confused as to why I am not able to view all the fields of a  
model I created when I try to create a new object. I checked my DB and  
they are all there, how ever when I click the “new” link to create a  
new object, some of the fields are missing. I edited the \_form by hand  
to add the missing fields, but “show” and “list” doesn’t list the  
items that were originally missing from create. I am new to rails and  
still trying to understand what is going on. Any help/insight would be  
greatly appreciated. Thanks  
-J

---

<div class="post-metadata">

**Author:** ![jvazquez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/858c86/32.png) [@jvazquez](https://www.ruby-forum.com/u/jvazquez)\
**Post date:** [January 6, 2008, 5:35pm UTC](https://www.ruby-forum.com/t/where-are-all-my-fields/125172/2 "2008-01-06T17:35:53Z")

</div>

On Jan 6, 2008 4:53 PM, jvazquez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am confused as to why I am not able to view all the fields of a  
> model I created when I try to create a new object. I checked my DB and  
> they are all there, how ever when I click the “new” link to create a  
> new object, some of the fields are missing. I edited the \_form by hand  
> to add the missing fields, but “show” and “list” doesn’t list the  
> items that were originally missing from create. I am new to rails and  
> still trying to understand what is going on. Any help/insight would be  
> greatly appreciated. Thanks

I’m guessing you used scaffolding, and then edited the migration (if  
not, then just ignore my post).  
Something like:

ruby script/generate scaffold product name:string price:decimal  
[a bunch of static files are generated, among others  
db/migrate/001\_create\_products.rb]

if, before you run the migration, you edit  
db/migrate/001\_create\_products.rb and add, let’s say, a description  
column, and then rake db:migrate, your table will include this new  
column, but your views are still in the same state they were in when  
you did the scaffolding, only showing the name and price fields you  
told the scaffold about.

The default scaffolding is a one time operation to get you started on  
a resource. Once the files are there, you have to edit them yourself.  
(Or run the scaffold again, or use one of the plugins for dynamic  
scaffolding etc.)

- Martin

---

<div class="post-metadata">

**Author:** ![jvazquez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/858c86/32.png) [@jvazquez](https://www.ruby-forum.com/u/jvazquez)\
**Post date:** [January 6, 2008, 7:19pm UTC](https://www.ruby-forum.com/t/where-are-all-my-fields/125172/3 "2008-01-06T19:19:50Z")

</div>

I did in fact use scaffolding, but I ran it after I generated my model  
and added all the columns I wanted. I just can’t wrap my head around  
what is wrong.  
How can I edit the show.rhtml to display the things that are missing?  
My understanding is that the following code(contained in show.rhtml)  
would display all columns contained in my DB

\<% for column in Housing.content\_columns %\>

**\<%= column.human\_name %\>:** \<%=h @housing.send(column.name) %\>

\<% end %\>

controller contains  
def show  
@housing = Housing.find(params[:id])  
end

---

<div class="post-metadata">

**Author:** ![jvazquez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/858c86/32.png) [@jvazquez](https://www.ruby-forum.com/u/jvazquez)\
**Post date:** [January 7, 2008, 8:37pm UTC](https://www.ruby-forum.com/t/where-are-all-my-fields/125172/4 "2008-01-07T20:37:39Z")

</div>

I think I have discovered what might be the problem. It appears that  
“content\_columns” Returns an array of column objects where the primary  
id, all columns ending in “\_id” or “\_count”, and columns used for  
single table inheritance have been removed. It turns out that my  
missing fields refer to columns ending in “id” and “count”. There is a  
similar “columns” method that should show me what I need.  
thanks  
-Juan
