# Scaffold and form generation issue

**URL:** <https://www.ruby-forum.com/t/scaffold-and-form-generation-issue/123776>\
**Category:** Rails\
**Created:** [December 20, 2007, 4:13pm UTC](https://www.ruby-forum.com/t/scaffold-and-form-generation-issue/123776 "2007-12-20T16:13:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkrkrk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@rkrkrk](https://www.ruby-forum.com/u/rkrkrk)\
**Post date:** [December 20, 2007, 4:13pm UTC](https://www.ruby-forum.com/t/scaffold-and-form-generation-issue/123776/1 "2007-12-20T16:13:23Z")

</div>

Hi,

I am new to rails - just installed it couple of days ago (version  
2.0.2). I was going through a tutorial on scaffold and it looked as  
if it is extremely simple to generate the working code for a simple  
table in no time. But I am facing some problem as I am unable to see  
the web form properly - it does not create the form according to the  
table definition in the database although it does create the action  
links. So, when I click on create - it creates an empty row in the  
table (the table only has id, name). The show page is empty but the  
click on update displays that update was successful.

Here is how I created the application:

1. create table categories in mysql with id(int), name(string)
2. run rails rlapp
3. cd rlapp
4. ruby script\generate db:migrate categories
5. ruby script\generate scaffold category
6. ruby script\server
7. open the categories page in the browser

I see that in edit.html.erb, there is a reference to form\_for method.  
Is the form\_for method not able to generate the proper form for the  
table?

Any help is really appreciated.

Below is the content of the edit file:

# Editing category

\<%= error\_messages\_for :category %\>

\<% form\_for(@category) do |f| %\>

\<%= f.submit "Update" %\>

\<% end %\>

\<%= link\_to ‘Show’, @category %\> |  
\<%= link\_to ‘Back’, categories\_path %\>

---

<div class="post-metadata">

**Author:** ![rkrkrk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@rkrkrk](https://www.ruby-forum.com/u/rkrkrk)\
**Post date:** [December 20, 2007, 4:25pm UTC](https://www.ruby-forum.com/t/scaffold-and-form-generation-issue/123776/2 "2007-12-20T16:25:46Z")

</div>

rk :

> Here is how I created the application:
> 
> 1. create table categories in mysql with id(int), name(string)
> 2. run rails rlapp
> 3. cd rlapp
> 4. ruby script\generate db:migrate categories
> 5. ruby script\generate scaffold category

script/generate scaffold category name:string

> 1. ruby script\server
> 2. open the categories page in the browser

```
-- Jean-François.
```

---

<div class="post-metadata">

**Author:** ![rkrkrk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@rkrkrk](https://www.ruby-forum.com/u/rkrkrk)\
**Post date:** [December 20, 2007, 5:30pm UTC](https://www.ruby-forum.com/t/scaffold-and-form-generation-issue/123776/3 "2007-12-20T17:30:15Z")

</div>

Thanks! That really works.

Is this a new change to the scaffold script? Most of the tutorials  
that I have seen does not mention this part. This also means that for  
a decent sized table we have to name all the columns on the command  
line?

On Dec 20, 10:24 am, “Jean-François Trân” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
