# Newbie question - Automatically update \_form.rhtml?

**URL:** <https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236>\
**Category:** Rails\
**Created:** [February 27, 2006, 11:05am UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236 "2006-02-27T11:05:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![azgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@azgar](https://www.ruby-forum.com/u/azgar)\
**Post date:** [February 27, 2006, 11:05am UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236/1 "2006-02-27T11:05:24Z")

</div>

Hi all, I’ve got an odd issue. I’m new to Ruby/Rails and have a bit of a  
silly question. I’m following along with the nice little tutorial here,  
to get an idea of the system:

> **[Radar - O’Reilly](https://www.oreilly.com/radar/?page=3)**
>
> Now, next, and beyond: Tracking need-to-know trends at the intersection of business and technology

However, I’m running into an issue where the author adds a new field in  
his database, refreshes the browser and shows the updated form with the  
new field.

Okay, maybe I’m missing something, but I can’t, for the life of me,  
figure out how this is done. I’ve actually poked the system enough to  
realise that the \_form.rhtml file is controlling this snipped, and that  
it’s not updating when I update my database.

Am I missing something here, or do I have to manually regenerate  
\_form.rhtml on database updates?

I’m running the newest Rails/Ruby (downloaded last week) on Lighttpd on  
my Gentoo Linux system. Any ideas?

Cheers

---

<div class="post-metadata">

**Author:** ![azgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@azgar](https://www.ruby-forum.com/u/azgar)\
**Post date:** [February 27, 2006, 11:24am UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236/2 "2006-02-27T11:24:05Z")

</div>

On 27/02/06, Paul S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Am I missing something here, or do I have to manually regenerate  
> \_form.rhtml on database updates?

You should consider a scaffold-generated files only as an example and  
customize them as soon as needed. You may regenerate them when  
database changes - but only during learning or in VERY early stage of  
development. Later on you have to and should adjust them manually.

---

<div class="post-metadata">

**Author:** ![azgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@azgar](https://www.ruby-forum.com/u/azgar)\
**Post date:** [February 27, 2006, 6:28pm UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236/3 "2006-02-27T18:28:42Z")

</div>

Åukasz Piestrzeniewicz wrote:

> On 27/02/06, Paul S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Am I missing something here, or do I have to manually regenerate  
> > \_form.rhtml on database updates?
> 
> You should consider a scaffold-generated files only as an example and  
> customize them as soon as needed. You may regenerate them when  
> database changes - but only during learning or in VERY early stage of  
> development. Later on you have to and should adjust them manually.

Åukasz I think you kind of bounced off the side of Paul’s question…  
he’s still learning  
and should be fine using scaffold for that.

Paul, I think that tutorial might be out of date now and was written  
back when the  
scaffolded form introspected the fields in your table on every request.  
At least I _think_  
it once did that… But if you look at a \_form.rhtml now it just has a  
generated input  
field for each column in your db. I think you need to regenerate it to  
see changes.

Someone please correct me if I’m wrong… Curt, you lurking about?

b

---

<div class="post-metadata">

**Author:** ![azgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@azgar](https://www.ruby-forum.com/u/azgar)\
**Post date:** [February 27, 2006, 6:50pm UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236/4 "2006-02-27T18:50:16Z")

</div>

Just wondering… did you run script/generate scaffold? Then the  
generated files won’t reflect your changes to the database anyway.

On 2/27/06, Juan Lupión [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Greetings.
> 
> ## [1]. [http://www.sobrerailes.com/articles/2006/02/24/tutorial-en-catellano-rolling-with-ruby-on-rails](http://www.sobrerailes.com/articles/2006/02/24/tutorial-en-catellano-rolling-with-ruby-on-rails)
> 
> * * *
> 
> [http://www.sobrerailes.com](http://www.sobrerailes.com)

–

---

<div class="post-metadata">

**Author:** ![azgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@azgar](https://www.ruby-forum.com/u/azgar)\
**Post date:** [February 27, 2006, 6:47pm UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236/5 "2006-02-27T18:47:11Z")

</div>

> Someone please correct me if I’m wrong… Curt, you lurking about?

Well, I followed Curt’s tutorial last week installing the latest  
revisions of everything (Ruby, Rails and friends) and had no problems  
whatsoever. (Just in case anyone’s interested, there is a spanish  
translation available here [1])

So my bet would be that there’s something wrong with Paul’s setup  
(Curt’s tutorial uses Windows+WEBrick while he is using  
Gentoo+lightty)… but I’m clueless…

Greetings.

## [1]. [http://www.sobrerailes.com/articles/2006/02/24/tutorial-en-catellano-rolling-with-ruby-on-rails](http://www.sobrerailes.com/articles/2006/02/24/tutorial-en-catellano-rolling-with-ruby-on-rails)

---

<div class="post-metadata">

**Author:** ![azgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@azgar](https://www.ruby-forum.com/u/azgar)\
**Post date:** [February 28, 2006, 9:32am UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236/6 "2006-02-28T09:32:23Z")

</div>

On 27/02/06, Ben M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Åukasz I think you kind of bounced off the side of Paul’s question… he’s still learning  
> and should be fine using scaffold for that.

I strongly disagree. Curt’s tutorial was a very valuable resource. Was

- a year ago. During this year Rails evolved. Now I consider this  
material more harmfull than helpfull. It just teaches too many bad  
habits. Adding fields to the database through clickety-clik? Using  
run-time scaffold instead of generated one?

Right now Apple’s tutorial is a lot better resource:  
[http://developer.apple.com/tools/rubyonrails.html](http://developer.apple.com/tools/rubyonrails.html)

---

<div class="post-metadata">

**Author:** ![azgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@azgar](https://www.ruby-forum.com/u/azgar)\
**Post date:** [February 28, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236/7 "2006-02-28T17:44:20Z")

</div>

Ok. Fair enough. I just didn’t see your answer answering his question…  
of course, I  
didn’t really help much either. 😉

Curt, I think Åukasz is calling you out. 😮

b

---

<div class="post-metadata">

**Author:** ![azgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@azgar](https://www.ruby-forum.com/u/azgar)\
**Post date:** [February 28, 2006, 9:41pm UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236/8 "2006-02-28T21:41:33Z")

</div>

On 2/28/06, Ben M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Ok. Fair enough. I just didn’t see your answer answering his question… of course, I  
> didn’t really help much either. 😉
> 
> Curt, I think Åukasz is calling you out. 😮

I basically agree. A lot has changed in Rails in the last year (boy is  
that an understatement). Migrations are the way to go for real  
database work, although I see nothing wrong with GUI DB development  
for someone who whose testing the waters.

I actually intended it to be an intro for Windows developers because  
(at the time) there was already plenty of material available for Linux  
& OSX. Because of this I deliberately took a very visual style.

Curt

---

<div class="post-metadata">

**Author:** ![azgar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@azgar](https://www.ruby-forum.com/u/azgar)\
**Post date:** [February 28, 2006, 4:55am UTC](https://www.ruby-forum.com/t/newbie-question-automatically-update-form-rhtml/54236/9 "2006-02-28T04:55:01Z")

</div>

On 2/27/06, Paul S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Okay, maybe I’m missing something, but I can’t, for the life of me,  
> figure out how this is done. I’ve actually poked the system enough to  
> realise that the \_form.rhtml file is controlling this snipped, and that  
> it’s not updating when I update my database.
> 
> Am I missing something here, or do I have to manually regenerate  
> \_form.rhtml on database updates?
> 
> I’m running the newest Rails/Ruby (downloaded last week) on Lighttpd on  
> my Gentoo Linux system. Any ideas?

If you followed the tutorial, then there shouldn’t even be a  
\_form.rhtml, because the tutorial usues dynamic scaffolding that does  
not generate any code (there’s another kind of scaffolding created  
with the “script/generate scaffold” command that does create code  
filles, but the tutorial does not use this).

You can download the source code for the cookbook app and compare it  
with yours to see what’s different:

[Radar – O’Reilly](http://www.onlamp.com/onlamp/2005/03/03/examples/cookbook_part2_0.13.1.zip)

Curt
