Scaffolding

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.

2009/7/4 Rajendra B. [email protected]:

'(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

On Sat, Jul 4, 2009 at 3:16 AM, Rajendra B. <
[email protected]> 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/.

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

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.