# Added columns do not show up in new action

**URL:** <https://www.ruby-forum.com/t/added-columns-do-not-show-up-in-new-action/123548>\
**Category:** Rails\
**Created:** [December 18, 2007, 5:36pm UTC](https://www.ruby-forum.com/t/added-columns-do-not-show-up-in-new-action/123548 "2007-12-18T17:36:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdellaringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7bcc69/32.png) [@tdellaringa](https://www.ruby-forum.com/u/tdellaringa)\
**Post date:** [December 18, 2007, 5:36pm UTC](https://www.ruby-forum.com/t/added-columns-do-not-show-up-in-new-action/123548/1 "2007-12-18T17:36:32Z")

</div>

I’m trying to write my first app in rails (no better way to learn than  
to do). I did my first migration to create the initial table, which  
worked fine. I generated the scaffold and added one new line item (a  
workout) to the database no problem.

I then wanted to add some more fields to the database table, so I built  
another migration…

class AddFields \< ActiveRecord::Migration  
def self.up  
add\_column :workouts, :weight, :text  
add\_column :workouts,:maxheart, :integer  
add\_column :workouts,:minheart, :integer  
add\_column :workouts,:avgheart, :integer  
add\_column :workouts,:timehour, :integer  
add\_column :workouts,:timemin, :integer  
add\_column :workouts,:timesec, :integer  
end

def self.down  
remove\_column :workouts,:weight  
remove\_column :workouts,:maxheart  
remove\_column :workouts,:minheart  
remove\_column :workouts,:avgheart  
remove\_column :workouts,:timehour  
remove\_column :workouts,:timemin  
remove\_column :workouts,:timesec  
end  
end

and ran rake, which worked fine. But when I go to the ‘new’ action,  
those fields do NOT show up. They are in fact in the database, because I  
logged into mysql and looked, and they show up in the list view as empty  
fields.

Am I missing a step to get them to show?

---

<div class="post-metadata">

**Author:** ![tdellaringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7bcc69/32.png) [@tdellaringa](https://www.ruby-forum.com/u/tdellaringa)\
**Post date:** [December 18, 2007, 6:06pm UTC](https://www.ruby-forum.com/t/added-columns-do-not-show-up-in-new-action/123548/2 "2007-12-18T18:06:02Z")

</div>

On Dec 18, 2007, at 10:36 AM, Tom D. wrote:

> Am I missing a step to get them to show?

If you actually generated the scaffold with

script/generate scaffold …

then you will have to edit the files to include the new fields.  
That’s actually the point of scaffolding…it’s just a place to get  
started. Have a look in views/ to see which files you  
will need to modify.

Peace,  
Phillip

---

<div class="post-metadata">

**Author:** ![tdellaringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7bcc69/32.png) [@tdellaringa](https://www.ruby-forum.com/u/tdellaringa)\
**Post date:** [December 18, 2007, 6:17pm UTC](https://www.ruby-forum.com/t/added-columns-do-not-show-up-in-new-action/123548/3 "2007-12-18T18:17:51Z")

</div>

Phillip K. wrote:

> On Dec 18, 2007, at 10:36 AM, Tom D. wrote:
> 
> > Am I missing a step to get them to show?
> 
> If you actually generated the scaffold with
> 
> script/generate scaffold …
> 
> then you will have to edit the files to include the new fields.  
> That’s actually the point of scaffolding…it’s just a place to get  
> started. Have a look in views/ to see which files you  
> will need to modify.
> 
> Peace,  
> Phillip

Ah! Duh…gotcha. So if I were using dynamic scaffolding it would have  
worked, but once I generated the actual files… makes sense. Thanks!
