# Scaffolding

**URL:** <https://www.ruby-forum.com/t/scaffolding/171541>\
**Category:** Rails\
**Created:** [July 4, 2009, 12:16pm UTC](https://www.ruby-forum.com/t/scaffolding/171541 "2009-07-04T12:16:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e8cbc/32.png) [@rajendra](https://www.ruby-forum.com/u/rajendra)\
**Post date:** [July 4, 2009, 12:16pm UTC](https://www.ruby-forum.com/t/scaffolding/171541/1 "2009-07-04T12:16:19Z")

</div>

hi , i used the folllwing command to scaffold,

G:\my\webblog\>ruby script/generate scaffold webblog id:integer  
title:string body  
:text created\_at:datetime

after when i migrate with the follwing command

rake db:migrate

i got the error as

# (in G:/my/webblog) == 1 CreateWebblogs: migrating

– create\_table(:webblogs)  
rake aborted!  
Mysql::Error: You have an error in your SQL syntax; check the manual  
that corres  
ponds to your MySQL server version for the right syntax to use near  
'(11), `titl e` varchar(255) DEFAULT NULL, `body` text DEFAULT NULL, `created_at` ’  
at line 1  
: CREATE TABLE `webblogs` (`id` int(11) DEFAULT NULL auto\_increment  
PRIMARY KEY(  
11), `title` varchar(255) DEFAULT NULL, `body` text DEFAULT NULL,  
`created_at` d  
atetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL) ENGINE=InnoDB

(See full trace by running task with --trace)

i got this error, can anyone help me??  
what can i do ,pls suggest me. i am using mysql 5.2 and rails 2.0.2 and  
ruby 1.8.6.

---

<div class="post-metadata">

**Author:** ![rajendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e8cbc/32.png) [@rajendra](https://www.ruby-forum.com/u/rajendra)\
**Post date:** [July 4, 2009, 1:05pm UTC](https://www.ruby-forum.com/t/scaffolding/171541/2 "2009-07-04T13:05:26Z")

</div>

2009/7/4 Rajendra B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> '(11), `titl
> 
> ## i got this error, can anyone help me?? what can i do ,pls suggest me. i am using mysql 5.2 and rails 2.0.2 and ruby 1.8.6.

I am not sure if either of these will fix the problem but:  
First I would upgrade to the latest rails (2.3.2)  
Second it is not necessary to specify id in the scaffold command.

Colin

---

<div class="post-metadata">

**Author:** ![rajendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e8cbc/32.png) [@rajendra](https://www.ruby-forum.com/u/rajendra)\
**Post date:** [July 4, 2009, 1:29pm UTC](https://www.ruby-forum.com/t/scaffolding/171541/3 "2009-07-04T13:29:58Z")

</div>

On Sat, Jul 4, 2009 at 3:16 AM, Rajendra B. \<  
removed\_email\_address@domain.invalid\> wrote:

> '(11), `titl
> 
> ## i got this error, can anyone help me?? what can i do ,pls suggest me. i am using mysql 5.2 and rails 2.0.2 and ruby 1.8.6.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Rajendra, you might want to use a different field than ‘id’ because each  
model has  
a field ‘id’ be default for managing the records within its associated  
table. Please  
try doing the following:

ruby script/generate scaffold webblog title:string description:text

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![rajendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e8cbc/32.png) [@rajendra](https://www.ruby-forum.com/u/rajendra)\
**Post date:** [July 4, 2009, 3:47pm UTC](https://www.ruby-forum.com/t/scaffolding/171541/4 "2009-07-04T15:47:47Z")

</div>

Upgrade to the lastest rails (for starters - unless for some reason you  
cannot)… 2.3.2

All tables are created with an id field so never use that. If you want  
to create a foreign key that is going to be used by multiple tables you  
could use something like webblog\_id if the webblog\_id is going to be the  
foreign key used to link existing tables.
